Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Tomas Vondra <tomas.vondra@2ndquadrant.com>
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Mark Dilger <hornschnorter@gmail.com>
Cc: Adrien Nayrat <adrien.nayrat@dalibo.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-11-25T17:56:03Z
Lists: pgsql-hackers
Attachments
- 0001-MCV-fix.patch (text/x-patch)
Hi, On 11/25/2017 05:15 PM, Mark Dilger wrote: > >> On Nov 18, 2017, at 12:28 PM, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote: >> >> Hi, >> >> Attached is an updated version of the patch, adopting the psql describe >> changes introduced by 471d55859c11b. >> >> regards >> >> -- >> Tomas Vondra http://www.2ndQuadrant.com >> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services >> <0001-multivariate-MCV-lists.patch.gz><0002-multivariate-histograms.patch.gz> > > Thanks, Tomas, again for your work on this feature. > > Applying just the 0001-multivariate-MCV-lists.patch to the current master, and > then extending the stats_ext.sql test as follows, I am able to trigger an error, > "ERROR: operator 4294934272 is not a valid ordering operator". > Ah, that's a silly bug ... The code assumes that VacAttrStats->extra_data is always StdAnalyzeData, and attempts to extract the ltopr from that. But for arrays that's of course not true (array_typanalyze uses ArrayAnalyzeExtraData instead). The reason why this only fails after the second INSERT is that we need at least two occurrences of a value before considering it eligible for MCV list. So after the first INSERT we don't even call the serialize. Attached is a fix that should resolve this in MCV lists by looking up the operator using lookup_type_cache() when serializing the MCV. FWIW histograms have the same issue, but on more places (not just in serialize, but also when building the histogram). I'll send a properly updated patch series shortly, with tests checking correct behavior with arrays. Thanks for the report. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Convert pre-existing stats_ext tests to new style
- dbb984128ebf 12.0 landed
-
Add support for multivariate MCV lists
- 7300a699502f 12.0 landed
-
Improve ANALYZE's strategy for finding MCVs.
- b5db1d93d2a6 11.0 cited
-
Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
- 5564c1181548 11.0 cited
-
Try again to fix accumulation of parallel worker instrumentation.
- 8526bcb2df76 11.0 cited
-
Adjust psql \d query to avoid use of @> operator.
- 471d55859c11 11.0 cited
-
Message style fixes
- 821fb8cdbf70 11.0 cited
-
Add security checks to selectivity estimation functions
- e2d4ef8de869 10.0 cited