postgresql/src/include
Simon Riggs 137805f89a 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
2016-04-08 02:51:09 +01:00
..
access Generic Messages for Logical Decoding 2016-04-06 10:05:41 +01:00
bootstrap Update copyright for 2016 2016-01-02 13:33:40 -05:00
catalog Phrase full text search. 2016-04-07 18:44:18 +03:00
commands Support ALTER THING .. DEPENDS ON EXTENSION 2016-04-05 18:38:54 -03:00
common Avoid PGDLLIMPORT for simple local references in frontend programs. 2016-03-23 23:26:44 -04:00
datatype Be more careful about out-of-range dates and timestamps. 2016-03-16 19:09:28 -04:00
executor Rework custom scans to work more like the new extensible node stuff. 2016-03-29 11:28:04 -04:00
fe_utils Move psql's psqlscan.l into src/fe_utils. 2016-03-24 20:28:47 -04:00
foreign Don't require a user mapping for FDWs to work. 2016-03-28 21:50:28 -04:00
lib Add two HyperLogLog functions 2016-01-19 17:40:15 -03:00
libpq Properly declare FeBeWaitSet. 2016-03-21 12:58:18 +01:00
mb Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodes Load FK defs into relcache for use by planner 2016-04-07 12:08:33 +01:00
optimizer Use Foreign Key relationships to infer multi-column join selectivity 2016-04-08 02:51:09 +01:00
parser Support ALTER THING .. DEPENDS ON EXTENSION 2016-04-05 18:38:54 -03:00
port Call xlc __isync() after, not before, associated compare-and-swap. 2016-02-19 22:47:50 -05:00
portability Update copyright for 2016 2016-01-02 13:33:40 -05:00
postmaster Allow the WAL writer to flush WAL at a reduced rate. 2016-02-16 00:56:34 +01:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:12:16 -05:00
replication Generic Messages for Logical Decoding 2016-04-06 10:05:41 +01:00
rewrite Update copyright for 2016 2016-01-02 13:33:40 -05:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Introduce WaitEventSet API. 2016-03-21 12:22:54 +01:00
tcop Widen query numbers-of-tuples-processed counters to uint64. 2016-03-12 16:05:29 -05:00
tsearch Phrase full text search. 2016-04-07 18:44:18 +03:00
utils Load FK defs into relcache for use by planner 2016-04-07 12:08:33 +01:00
.gitignore Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
c.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
fmgr.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
funcapi.h Widen query numbers-of-tuples-processed counters to uint64. 2016-03-12 16:05:29 -05:00
getaddrinfo.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
getopt_long.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
Makefile Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
miscadmin.h Add idle_in_transaction_session_timeout. 2016-03-16 11:30:45 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Change the way that LWLocks for extensions are allocated. 2016-02-04 16:43:04 -05:00
pg_config.h.in Introduce WaitEventSet API. 2016-03-21 12:22:54 +01:00
pg_config.h.win32 Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>. 2016-03-15 13:19:57 -04:00
pg_getopt.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
pg_trace.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
pgstat.h Add simple VACUUM progress reporting. 2016-03-15 13:32:56 -04:00
pgtar.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
pgtime.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
port.h On all Windows platforms, not just Cygwin, use _timezone and _tzname. 2016-03-28 20:59:25 -04:00
postgres_ext.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
postgres_fe.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
postgres.h Widen query numbers-of-tuples-processed counters to uint64. 2016-03-12 16:05:29 -05:00
rusagestub.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
windowapi.h Update copyright for 2016 2016-01-02 13:33:40 -05:00