Re: [HACKERS] PATCH: multivariate histograms and MCV lists - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Date
Msg-id 464684DD-2FC7-40E4-8B9C-1FEB9F0BC4D5@gmail.com
Whole thread Raw
In response to Re: [HACKERS] PATCH: multivariate histograms and MCV lists  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: [HACKERS] PATCH: multivariate histograms and MCV lists  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
> On Mar 3, 2018, at 2:40 PM, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>
> An updated patch version, fixing the breakage caused by fd1a421fe6
> twiddling with pg_proc.

Hi Tomas, thanks again for this most useful patch!

Perhaps this is intentional, but there seems to be a place in src/backend/parser/parse_utilcmd.c
that is overlooked in your recent patch set.  The simplest fix would be:

diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 0fd14f43c6..6ec7818f31 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -1661,6 +1661,10 @@ generateClonedExtStatsStmt(RangeVar *heapRel, Oid heapRelid,
                        stat_types = lappend(stat_types, makeString("ndistinct"));
                else if (enabled[i] == STATS_EXT_DEPENDENCIES)
                        stat_types = lappend(stat_types, makeString("dependencies"));
+               else if (enabled[i] == STATS_EXT_MCV)
+                       stat_types = lappend(stat_types, makeString("mcv"));
+               else if (enabled[i] == STATS_EXT_HISTOGRAM)
+                       stat_types = lappend(stat_types, makeString("histogram"));
                else
                        elog(ERROR, "unrecognized statistics kind %c", enabled[i]);
        }

diff --git a/src/test/regress/expected/create_table_like.out b/src/test/regress/expected/create_table_like.out
index 52ff18c8ca..d7454648fc 100644
--- a/src/test/regress/expected/create_table_like.out
+++ b/src/test/regress/expected/create_table_like.out
@@ -243,7 +243,7 @@ Indexes:
 Check constraints:
     "ctlt1_a_check" CHECK (length(a) > 2)
 Statistics objects:
-    "public"."ctlt_all_a_b_stat" (ndistinct, dependencies) ON a, b FROM ctlt_all
+    "public"."ctlt_all_a_b_stat" (ndistinct, dependencies, mcv, histogram) ON a, b FROM ctlt_all

 SELECT c.relname, objsubid, description FROM pg_description, pg_index i, pg_class c WHERE classoid =
'pg_class'::regclassAND objoid = i.indexrelid AND c.oid = i.indexrelid AND i.indrelid = 'ctlt_all'::regclass ORDER BY
c.relname,objsubid; 
     relname     | objsubid | description


Otherwise, perhaps you could include a comment about why STATS_EXT_MCV and
STATS_EXT_HISTOGRAM are not handled in this case.

mark






pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Concurrency bug in UPDATE of partition-key
Next
From: Craig Ringer
Date:
Subject: Re: disable SSL compression?