emitting all plans considered for a query (as opposed to just the winning one)

From: Dan Hitt <dan(dot)hitt(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: emitting all plans considered for a query (as opposed to just the winning one)
Date: 2017-03-01 03:32:16
Message-ID: CAOphizKXjvb+oQ2YdyDA2sLE1m5VjAzREkawbJ2hv6atvgPxXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Suppose that i have a select query that involves a small number of
joins, say 3 or 4 and a few where conditions.

I want to list all the query plans that the postgres planner
considers. I understand that for a small number of joins, the planner
actually considers all possible execution plans.

I haven't been able to find any command on the net that would just
dump all the plans out so that i could see what is possible in
principle (before taking into account the size of the tables or the
distribution of values within them).

And yet, such a list must exist, at least internally, and further,
when the planner is debugged or subjected to regression testing, there
must be a way to see what plans it is considering ---- although
conceivably it could all just be using gdb to step through internal
structures.

Anyhow, would appreciate this very much, and thanks in advance for any
info about how to do this, or where to search. (Maybe i'm just
looking in all the wrong places.)

dan

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2017-03-01 04:42:45 Re: [GENERAL] C++ port of Postgres
Previous Message Jong-won Choi 2017-03-01 02:06:28 Re: array_to_json - dealing with returning no rows