From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Philip Semanchuk <philip(at)americanefficient(dot)com> |
Cc: | Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Michael Lewis <mlewis(at)entrata(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Understanding bad estimate (related to FKs?) |
Date: | 2020-11-02 19:53:39 |
Message-ID: | 20201102195339.GK22691@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Mon, Nov 02, 2020 at 02:09:03PM -0500, Philip Semanchuk wrote:
> Bien merci, yes, I've visited most of those links and learned an enormous amount from them. I've downloaded many of them for re-reading, including yours. :-) It's helpful to be reminded of them again.
>
> EXPLAIN ANALYZE tells me what choices the planner made, but it doesn't tell me why the planner made those choices. For instance, Tomas Vondra's post enabled me to calculate how the planner arrived at its estimate of 7 rows for one node of my query. I would prefer not to reverse engineer the planner's calculation, but instead have the planner just tell me.
>
> If I was able to combine that information with a summary of the planner's algorithm (a lot to ask for!), then I could understand how the planner chose its plan.
>
> The query I asked about in the original post of this thread has 13 relations in it. IIUC, that's 13! or > 6 billion possible plans. How did the planner pick one plan out of 6 billion? I'm curious, both for practical purposes (I want my query to run well) and also because it's fascinating.
I hestitate to suggest it, but maybe you'd want to use
./configure CFLAGS='-DOPTIMIZER_DEBUG=1'
which will print out costs of each plan node considered.
You could also read in selfuncs.c and costsize.c and related parts of the
source.
--
Justin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-11-02 20:08:12 | Re: Understanding bad estimate (related to FKs?) |
Previous Message | Philip Semanchuk | 2020-11-02 19:09:03 | Re: Understanding bad estimate (related to FKs?) |