Re: Understanding bad estimate (related to FKs?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Michael Lewis <mlewis(at)entrata(dot)com>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Understanding bad estimate (related to FKs?)
Date: 2020-11-02 20:08:12
Message-ID: 741231.1604347692@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Philip Semanchuk <philip(at)americanefficient(dot)com> writes:
> 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.

The twenty-thousand-foot overview is

https://www.postgresql.org/docs/devel/planner-optimizer.html

and then ten-thousand-foot level is the planner README file,

https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/optimizer/README;hb=HEAD

and then you pretty much gotta start reading code. You could also dig
into various planner expository talks that people have given at PG
conferences. I don't have links at hand, but there have been several.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Guillaume Lelarge 2020-11-02 20:48:52 Re: Understanding bad estimate (related to FKs?)
Previous Message Justin Pryzby 2020-11-02 19:53:39 Re: Understanding bad estimate (related to FKs?)