pgsql: Collect and use multi-column dependency stats

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Collect and use multi-column dependency stats
Date: 2017-04-05 22:06:02
Message-ID: E1cvt3y-0008R4-5z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Collect and use multi-column dependency stats

Follow on patch in the multi-variate statistics patch series.

CREATE STATISTICS s1 WITH (dependencies) ON (a, b) FROM t;
ANALYZE;
will collect dependency stats on (a, b) and then use the measured
dependency in subsequent query planning.

Commit 7b504eb282ca2f5104b5c00b4f05a3ef6bb1385b added
CREATE STATISTICS with n-distinct coefficients. These are now
specified using the mutually exclusive option WITH (ndistinct).

Author: Tomas Vondra, David Rowley
Reviewed-by: Kyotaro HORIGUCHI, Álvaro Herrera, Dean Rasheed, Robert Haas
and many other comments and contributions
Discussion: https://postgr.es/m/56f40b20-c464-fad2-ff39-06b668fac47c@2ndquadrant.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2686ee1b7ccfb9214064d4d2a98ea77382880306

Modified Files
--------------
contrib/file_fdw/file_fdw.c | 1 +
contrib/postgres_fdw/postgres_fdw.c | 5 +-
doc/src/sgml/catalogs.sgml | 9 +
doc/src/sgml/planstats.sgml | 154 +++
doc/src/sgml/ref/create_statistics.sgml | 42 +-
src/backend/catalog/system_views.sql | 3 +-
src/backend/commands/statscmds.c | 17 +-
src/backend/optimizer/path/clausesel.c | 113 ++-
src/backend/optimizer/path/costsize.c | 25 +-
src/backend/optimizer/util/orclauses.c | 4 +-
src/backend/optimizer/util/plancat.c | 12 +
src/backend/statistics/Makefile | 2 +-
src/backend/statistics/README | 68 +-
src/backend/statistics/README.dependencies | 119 +++
src/backend/statistics/dependencies.c | 1079 ++++++++++++++++++++++
src/backend/statistics/extended_stats.c | 105 ++-
src/backend/utils/adt/ruleutils.c | 54 +-
src/backend/utils/adt/selfuncs.c | 20 +-
src/bin/psql/describe.c | 12 +-
src/include/catalog/pg_cast.h | 4 +
src/include/catalog/pg_proc.h | 9 +
src/include/catalog/pg_statistic_ext.h | 7 +-
src/include/catalog/pg_type.h | 4 +
src/include/optimizer/cost.h | 6 +-
src/include/statistics/extended_stats_internal.h | 5 +
src/include/statistics/statistics.h | 44 +
src/test/regress/expected/opr_sanity.out | 3 +-
src/test/regress/expected/rules.out | 3 +-
src/test/regress/expected/stats_ext.out | 110 ++-
src/test/regress/expected/type_sanity.out | 7 +-
src/test/regress/sql/stats_ext.sql | 68 ++
31 files changed, 2035 insertions(+), 79 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2017-04-05 22:24:15 pgsql: Reduce lock level for CREATE STATISTICS
Previous Message Simon Riggs 2017-04-05 19:40:07 pgsql: Allow --with-wal-segsize=n up to n=1024MB

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2017-04-05 22:16:41 Re: multivariate statistics (v25)
Previous Message Andres Freund 2017-04-05 21:41:59 Re: PoC plpgsql - possibility to force custom or generic plan