Subject: Getting all the plans.

From: Senthilnathan M <[email-masked]>
Date: Sat, 22 Mar 2025 21:01:57 +0530

Hi all,
  I came across this extension which shows all the plans considered by the
optimizer: https://github.com/misachi/pg_all_plans

  Is there a way we can get this information directly instead of using an
extension?  If not, does it make sense to add native support?

  Please feel free to redirect me if this is not the right mailing list for
this topic.

Thanks,
Senthil

---

From: Tom Lane <[email-masked]>
Date: Sat, 22 Mar 2025 12:16:41 -0400

> extension?  If not, does it make sense to add native support?

The reason it's an extension is that the idea has already been
rejected (many times) by the core project.

FYI, this particular version is not showing you anywhere near "all"
the considered plans.  That's impossible really because the planner
prunes the search space as heavily as it can.  Most potential plans
are not carried as far as generating a complete Path tree in the
first place.  Even the ones that do get to the "final rel" stage
will be thrown away if they are dominated by some other one on
all the planner's figures-of-merit.  So this is going to show you
only a small fraction of the possible plans.  If you are unhappy
because you suspect the planner rejected what would really have
been the best plan, the odds are good this won't help you because
the plan you want to see didn't survive long enough to be shown.

			regards, tom lane