From: Simon Riggs <simon@2ndQuadrant.com>
To: pgsql-committers@postgresql.org
Subject: pgsql: Use Foreign Key relationships to infer multi-column join selecti
Date: Fri, 08 Apr 2016 01:51:52 +0000
Message-ID: <E1aoLaS-0005ZY-QL@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Use Foreign Key relationships to infer multi-column join selectivity
In cases where joins use multiple columns we currently assess each join
separately causing gross mis-estimates for join cardinality.
This patch adds use of FK information for the first time into the
planner. When FKs are present and we have multi-column join information,
plan estimates will be drastically improved. Cases with multiple FKs
are handled, though partial matches are ignored currently.
Net effect is substantial performance improvements for joins in many
common cases. Additional planning time is isolated to cases that are
currently performing poorly, measured at 0.08 - 0.15 ms.
Please watch for planner performance regressions; circumstances seem
unlikely but the law of unintended consequences may apply somewhen.
Additional complex tests welcome to prove this before release.
Tests can be performed using SET enable_fkey_estimates = on | off
using scripts provided during Hackers discussions, message id:
552335D9.3090707@2ndquadrant.com
Authors: Tomas Vondra and David Rowley
Reviewed and tested by Simon Riggs, adding comments only
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/137805f89acb361144ec98d9847e26d2848aa57e
Modified Files
--------------
src/backend/optimizer/path/costsize.c | 375 ++++++++++++++++++++++++++++++-
src/backend/utils/misc/guc.c | 9 +
src/include/optimizer/cost.h | 1 +
src/include/optimizer/paths.h | 2 +
src/test/regress/expected/rangefuncs.out | 29 +--
5 files changed, 392 insertions(+), 24 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: simon@2ndQuadrant.com
Subject: Re: pgsql: Use Foreign Key relationships to infer multi-column join selecti
In-Reply-To: <E1aoLaS-0005ZY-QL@gemulon.postgresql.org>
References: <E1aoLaS-0005ZY-QL@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