Re: [HACKERS] PATCH: multivariate histograms and MCV lists
> On Sep 12, 2017, at 2:06 PM, Tomas Vondra > wrote: > > Attached is an updated version of the patch, dealing with fallout of > 821fb8cdbf700a8aadbe12d5b46ca4e61be5a8a8 which touched the SGML > documentation for CREATE STATISTICS. Your patches need updating. Tom's commit 471d55859c11b40059aef7dd82f82b3a0dc338b1 changed src/bin/psql/describe.c, which breaks your 0001-multivariate-MCV-lists.patch.gz file. I reviewed the patch a few months ago, and as I recall, it looked good to me. I should review it again before approving it, though. mark -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Attached is an updated version of the patch, dealing with fallout of 821fb8cdbf700a8aadbe12d5b46ca4e61be5a8a8 which touched the SGML documentation for CREATE STATISTICS. regards On 09/07/2017 10:07 PM, Tomas Vondra wrote: > Hi, > > Attached is an updated version of the patch, fixing the issues reported > by Adrien Nayrat, and also a bunch of issues pointed out by valgrind. > > regards > -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services 0001-multivariate-MCV-lists.patch.gz Description: application/gzip 0002-multivariate-histograms.patch.gz Description: application/gzip -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Hi, Attached is an updated version of the patch, fixing the issues reported by Adrien Nayrat, and also a bunch of issues pointed out by valgrind. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services 0001-MCV-lists.patch.gz Description: application/gzip 0002-multivariate-histograms.patch.gz Description: application/gzip -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] PATCH: multivariate histograms and MCV lists
On 08/17/2017 12:06 PM, Adrien Nayrat wrote:> > Hello, > > There is no check of "statistics type/kind" in > pg_stats_ext_mcvlist_items and pg_histogram_buckets. > > select stxname,stxkind from pg_statistic_ext ; stxname | stxkind > ---+- stts3 | {h} stts2 | {m} > > So you can call : > > SELECT * FROM pg_mcv_list_items((SELECT oid FROM pg_statistic_ext > WHERE stxname = 'stts3')); > > SELECT * FROM pg_histogram_buckets((SELECT oid FROM pg_statistic_ext > WHERE stxname = 'stts2'), 0); > > Both crashes. > Thanks for the report, this is clearly a bug. I don't think we need to test the stxkind, but rather a missing check that the requested type is actually built. > Unfotunately, I don't have the knowledge to produce a patch :/ > > Small fix in documentation, patch attached. > Thanks, will fix. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] PATCH: multivariate histograms and MCV lists
On 08/14/2017 12:48 AM, Tomas Vondra wrote: > Hi all, > > For PostgreSQL 10 we managed to get the basic CREATE STATISTICS bits in > (grammar, infrastructure, and two simple types of statistics). See: > > https://commitfest.postgresql.org/13/852/ > > This patch presents a rebased version of the remaining parts, adding more > complex statistic types (MCV lists and histograms), and hopefully some > additional improvements. > > The code was rebased on top of current master, and I've made various > improvements to match how the committed parts were reworked. So the basic idea > and shape remains the same, the tweaks are mostly small. > > > regards > > > > Hello, There is no check of "statistics type/kind" in pg_stats_ext_mcvlist_items and pg_histogram_buckets. select stxname,stxkind from pg_statistic_ext ; stxname | stxkind ---+- stts3 | {h} stts2 | {m} So you can call : SELECT * FROM pg_mcv_list_items((SELECT oid FROM pg_statistic_ext WHERE stxname = 'stts3')); SELECT * FROM pg_histogram_buckets((SELECT oid FROM pg_statistic_ext WHERE stxname = 'stts2'), 0); Both crashes. Unfotunately, I don't have the knowledge to produce a patch :/ Small fix in documentation, patch attached. Thanks! -- Adrien NAYRAT http://dalibo.com - http://dalibo.org diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 3a86577b0a..a4ab48cc81 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -6445,7 +6445,9 @@ SCRAM-SHA-256$: < An array containing codes for the enabled statistic types; valid values are: d for n-distinct statistics, -f for functional dependency statistics +f for functional dependency statistics, +m for mcv statistics, +h for histogram statistics diff --git a/doc/src/sgml/planstats.sgml b/doc/src/sgml/planstats.sgml index 8857fc7542..9faa7ee393 100644 --- a/doc/src/sgml/planstats.sgml +++ b/doc/src/sgml/planstats.sgml @@ -653,7 +653,7 @@ Statistics objects: pg_mcv_list_items set-returning function. -SELECT * FROM pg_mcv_list_items((SELECT oid FROM pg_statistic_ext WHERE staname = 'stts2')); +SELECT * FROM pg_mcv_list_items((SELECT oid FROM pg_statistic_ext WHERE stxname = 'stts2')); index | values | nulls | frequency ---+-+---+--- 0 | {0,0} | {f,f} | 0.01 @@ -783,7 +783,7 @@ EXPLAIN ANALYZE SELECT * FROM t WHERE a = 1 AND b = 1; using a function called pg_histogram_buckets. -test=# SELECT * FROM pg_histogram_buckets((SELECT oid FROM pg_statistic_ext WHERE staname = 'stts3'), 0); +test=# SELECT * FROM pg_histogram_buckets((SELECT oid FROM pg_statistic_ext WHERE stxname = 'stts3'), 0); index | minvals | maxvals | nullsonly | mininclusive | maxinclusive | frequency | density | bucket_volume ---+-+-+---+--+--+---+--+--- 0 | {0,0} | {3,1} | {f,f} | {t,t}| {f,f}| 0.01 | 1.68 | 0.005952 signature.asc Description: OpenPGP digital signature