Thread: Does anyone ever use OPTIMIZER_DEBUG?

Does anyone ever use OPTIMIZER_DEBUG?

From
David Rowley
Date:
In c4a1933b4 I pushed a fix for a 4 year old bug in print_path() where
I'd forgotten to add handling for TidRangePaths while working on
bb437f995.

4 years is quite a long time for such a bug. Maybe that's because
nobody uses OPTIMIZER_DEBUG. I certainly don't, and Tom mentions [1]
he doesn't either.

Is there anyone out there who uses it?

If not, it's about 320 lines of uselessness.

David

[1] https://www.postgresql.org/message-id/951421.1695911023@sss.pgh.pa.us



Re: Does anyone ever use OPTIMIZER_DEBUG?

From
Tom Lane
Date:
David Rowley <dgrowleyml@gmail.com> writes:
> In c4a1933b4 I pushed a fix for a 4 year old bug in print_path() where
> I'd forgotten to add handling for TidRangePaths while working on
> bb437f995.
> 4 years is quite a long time for such a bug. Maybe that's because
> nobody uses OPTIMIZER_DEBUG. I certainly don't, and Tom mentions [1]
> he doesn't either.
> Is there anyone out there who uses it?
> If not, it's about 320 lines of uselessness.

We could also discuss keeping the "tracing" aspect of it, but
replacing debug_print_rel with pprint(rel), which'd still allow
removal of all the "DEBUG SUPPORT" stuff at the bottom of allpaths.c.
That's pretty much all of the maintenance-requiring stuff in it.

            regards, tom lane



Re: Does anyone ever use OPTIMIZER_DEBUG?

From
Michael Paquier
Date:
On Fri, Sep 29, 2023 at 10:20:39AM +1300, David Rowley wrote:
> 4 years is quite a long time for such a bug. Maybe that's because
> nobody uses OPTIMIZER_DEBUG. I certainly don't, and Tom mentions [1]
> he doesn't either.

I've used it perhaps once in the last 10 years, so removing it is OK
by me.
--
Michael

Attachment

Re: Does anyone ever use OPTIMIZER_DEBUG?

From
David Rowley
Date:
On Fri, 29 Sept 2023 at 10:59, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> We could also discuss keeping the "tracing" aspect of it, but
> replacing debug_print_rel with pprint(rel), which'd still allow
> removal of all the "DEBUG SUPPORT" stuff at the bottom of allpaths.c.
> That's pretty much all of the maintenance-requiring stuff in it.

To assist discussion, I've attached a patch for that.

I likely can't contribute much to that discussion due to being more of
an "attach a debugger" person rather than an "add printf statements"
person.

To eliminate a hurdle for anyone who wants to chip in, I've attached
the old and new debug output from the following query:

select * from pg_class where oid = 1234;

One observation is that the output is quite a bit larger with the
patched version and does not seem as useful if you wanted
OPTIMIZER_DEBUG to help you figure out why a given Path was chosen.

David

Attachment

Re: Does anyone ever use OPTIMIZER_DEBUG?

From
David Rowley
Date:
On Tue, 3 Oct 2023 at 12:29, David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Fri, 29 Sept 2023 at 10:59, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > We could also discuss keeping the "tracing" aspect of it, but
> > replacing debug_print_rel with pprint(rel), which'd still allow
> > removal of all the "DEBUG SUPPORT" stuff at the bottom of allpaths.c.
> > That's pretty much all of the maintenance-requiring stuff in it.
>
> To assist discussion, I've attached a patch for that.

It looks like nobody is objecting to this.  I understand that not
everyone who might object will have read this email thread, so what I
propose to do here is move along and just commit the patch to swap out
debug_print_rel and use pprint instead.  If that's done now then there
are around 10 months where we could realistically revert this again if
someone were to come forward with an objection.

Sound ok?

David



Re: Does anyone ever use OPTIMIZER_DEBUG?

From
Tom Lane
Date:
David Rowley <dgrowleyml@gmail.com> writes:
> It looks like nobody is objecting to this.  I understand that not
> everyone who might object will have read this email thread, so what I
> propose to do here is move along and just commit the patch to swap out
> debug_print_rel and use pprint instead.  If that's done now then there
> are around 10 months where we could realistically revert this again if
> someone were to come forward with an objection.

> Sound ok?

WFM.

            regards, tom lane



Re: Does anyone ever use OPTIMIZER_DEBUG?

From
David Rowley
Date:
On Mon, 9 Oct 2023 at 10:28, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > It looks like nobody is objecting to this.  I understand that not
> > everyone who might object will have read this email thread, so what I
> > propose to do here is move along and just commit the patch to swap out
> > debug_print_rel and use pprint instead.  If that's done now then there
> > are around 10 months where we could realistically revert this again if
> > someone were to come forward with an objection.
>
> > Sound ok?
>
> WFM.

Ok. I've pushed the patch.  Let's see if anyone comes forward.

David