Subject: Re: Does anyone ever use OPTIMIZER_DEBUG?

From: Tom Lane <[email-masked]>
Date: Thu, 28 Sep 2023 17:59:45 -0400

David Rowley <[email-masked]> 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

---

From: David Rowley <[email-masked]>
Date: Tue, 3 Oct 2023 12:29:46 +1300

> 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