pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Philip Semanchuk <philip@americanefficient.com>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Michael Lewis <mlewis@entrata.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Understanding bad estimate (related to FKs?)
Date: Mon, 02 Nov 2020 15:08:12 -0500
Message-ID: <741231.1604347692@sss.pgh.pa.us> (raw)
In-Reply-To: <482DBA7F-1094-4768-8D45-40936E0D1F63@americanefficient.com>
References: <7AC7104E-E233-4CCA-B99E-12197D61A4DD@americanefficient.com>
	<20201026170405.GT9241@telsasoft.com>
	<DF40D416-6F79-4912-9306-F012D0BED09A@americanefficient.com>
	<CAHOFxGpcN+=Vo10=2roxOOm8UXu8zstdaggRq0vvu00wcC6YjQ@mail.gmail.com>
	<20201029011343.GO5380@telsasoft.com>
	<BBBF43FB-9C74-401B-807A-C8888CD7DA40@americanefficient.com>
	<20201029224845.ptteqhzq65bh6jsh@development>
	<44E8D04E-A362-409B-AD2B-1D5860D01B61@americanefficient.com>
	<CAECtzeUcBHVv0DgazyufH2r57=gsdC-hGObKLCTRFwKFSKZezQ@mail.gmail.com>
	<482DBA7F-1094-4768-8D45-40936E0D1F63@americanefficient.com>

Philip Semanchuk <philip@americanefficient.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=H...

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





view thread (18+ messages)  latest in thread

Message-ID: <741231.1604347692@sss.pgh.pa.us>
Permalink:  ../741231.1604347692@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/741231.1604347692@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, philip@americanefficient.com, guillaume@lelarge.info, tomas.vondra@2ndquadrant.com, pryzby@telsasoft.com, mlewis@entrata.com
  Subject: Re: Understanding bad estimate (related to FKs?)
  In-Reply-To: <741231.1604347692@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox