Re: multivariate statistics (v24)
Tomas Vondra <tomas.vondra@2ndquadrant.com>
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: David Fetter <david@fetter.org>, Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2017-03-02T03:05:34Z
Lists: pgsql-hackers
Attachments
- 0001-teach-pull_-varno-varattno-_walker-about-Restric-v24.patch.gz (application/gzip) patch v24-0001
- 0002-PATCH-shared-infrastructure-and-ndistinct-coeffi-v24.patch.gz (application/gzip) patch v24-0002
- 0003-PATCH-functional-dependencies-only-the-ANALYZE-p-v24.patch.gz (application/gzip) patch v24-0003
- 0004-PATCH-selectivity-estimation-using-functional-de-v24.patch.gz (application/gzip) patch v24-0004
- 0005-PATCH-multivariate-MCV-lists-v24.patch.gz (application/gzip) patch v24-0005
- 0006-PATCH-multivariate-histograms-v24.patch.gz (application/gzip) patch v24-0006
- 0007-WIP-use-ndistinct-for-selectivity-estimation-in--v24.patch.gz (application/gzip) patch v24-0007
- 0008-WIP-allow-using-multiple-statistics-in-clauselis-v24.patch.gz (application/gzip) patch v24-0008
- 0009-WIP-psql-tab-completion-basics-v24.patch.gz (application/gzip) patch v24-0009
OK, attached is v24 of the patch series, addressing most of the reported issues and comments (at least I believe so). The main changes are: 1) I've mostly abandoned the "multivariate" name in favor of "extended", particularly in places referring to stats stored in the pg_statistic_ext in general. "Multivariate" is now used only in places talking about particular types (e.g. multivariate histograms). The "extended" name is more widely used for this type of statistics, and the assumption is that we'll also add other (non-multivariate) types of statistics - e.g. statistics on custom expressions, or some for of join statistics. 2) Catalog pg_mv_statistic was renamed to pg_statistic_ext (and pg_mv_stats view renamed to pg_stats_ext). 3) The structure of pg_statistic_ext was changed as proposed by Alvaro, i.e. the boolean flags were removed and instead we have just a single "char[]" column with list of enabled statistics. 4) I also got rid of the "mv" part in most variable/function/constant names, replacing it by "ext" or something similar. Also mvstats.h got renamed to stats.h. 5) Moved the files from src/backend/utils/mvstats to backend/statistics. 6) Fixed the n_choose_k() overflow issues by using the algorithm proposed by Dean. Also, use the simple formula for num_combinations(). 7) I've tweaked data types for a few struct members (in stats.h). I've kept most of the uint32 fields at the top level though, because int16 might not be large enough for large statistics and the overhead is minimal (compared to the space needed e.g. for histogram buckets). The renames/changes were quite widespread, but I've done my best to fix all the comments and various other places. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Collect and use multi-column dependency stats
- 2686ee1b7ccf 10.0 landed
-
Implement SortSupport for macaddr data type
- f90d23d0c518 10.0 cited
-
Implement multivariate n-distinct coefficients
- 7b504eb282ca 10.0 landed
-
Generate fmgr prototypes automatically
- 352a24a1f9d6 10.0 cited