From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Restore foreign-key-aware estimation of join relation sizes.
Date: Sat, 18 Jun 2016 19:22:43 +0000
Message-ID: <E1bELpL-0006Km-3u@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Restore foreign-key-aware estimation of join relation sizes.
This patch provides a new implementation of the logic added by commit
137805f89 and later removed by 77ba61080. It differs from the original
primarily in expending much less effort per joinrel in large queries,
which it accomplishes by doing most of the matching work once per query not
once per joinrel. Hopefully, it's also less buggy and better commented.
The never-documented enable_fkey_estimates GUC remains gone.
There remains work to be done to make the selectivity estimates account
for nulls in FK referencing columns; but that was true of the original
patch as well. We may be able to address this point later in beta.
In the meantime, any error should be in the direction of overestimating
rather than underestimating joinrel sizes, which seems like the direction
we want to err in.
Tomas Vondra and Tom Lane
Discussion: <31041.1465069446@sss.pgh.pa.us>
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/100340e2dcd05d6505082a8fe343fb2ef2fa5b2a
Modified Files
--------------
src/backend/nodes/copyfuncs.c | 26 +++
src/backend/nodes/outfuncs.c | 60 +++++++
src/backend/optimizer/path/costsize.c | 275 ++++++++++++++++++++++++++++--
src/backend/optimizer/path/equivclass.c | 79 +++++++++
src/backend/optimizer/plan/analyzejoins.c | 5 +
src/backend/optimizer/plan/initsplan.c | 153 +++++++++++++++++
src/backend/optimizer/plan/planmain.c | 9 +
src/backend/optimizer/util/plancat.c | 98 +++++++++++
src/backend/optimizer/util/relnode.c | 4 +-
src/backend/utils/cache/relcache.c | 153 ++++++++++++++++-
src/include/nodes/nodes.h | 4 +-
src/include/nodes/relation.h | 32 ++++
src/include/optimizer/cost.h | 4 +-
src/include/optimizer/paths.h | 3 +
src/include/optimizer/planmain.h | 1 +
src/include/utils/rel.h | 32 ++++
src/include/utils/relcache.h | 1 +
17 files changed, 921 insertions(+), 18 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Restore foreign-key-aware estimation of join relation sizes.
In-Reply-To: <E1bELpL-0006Km-3u@gemulon.postgresql.org>
References: <E1bELpL-0006Km-3u@gemulon.postgresql.org>
* 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