From 2bd4e4f1499f23c27c3488d73d6fe012232936c6 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Sun, 28 Jul 2019 11:41:31 +0200 Subject: [PATCH] don't build stats for inheritance trees --- src/backend/commands/analyze.c | 4 ++-- src/backend/statistics/extended_stats.c | 6 +++++- src/include/statistics/statistics.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 8d633f2585..9dc2aaadf7 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -575,8 +575,8 @@ do_analyze_rel(Relation onerel, VacuumParams *params, } /* Build extended statistics (if there are any). */ - BuildRelationExtStatistics(onerel, totalrows, numrows, rows, attr_cnt, - vacattrstats); + BuildRelationExtStatistics(onerel, inh, totalrows, numrows, rows, + attr_cnt, vacattrstats); } /* diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c index 23c74f7d90..8a9a396765 100644 --- a/src/backend/statistics/extended_stats.c +++ b/src/backend/statistics/extended_stats.c @@ -80,7 +80,7 @@ static void statext_store(Oid relid, * requested stats, and serializes them back into the catalog. */ void -BuildRelationExtStatistics(Relation onerel, double totalrows, +BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows, int numrows, HeapTuple *rows, int natts, VacAttrStats **vacattrstats) { @@ -90,6 +90,10 @@ BuildRelationExtStatistics(Relation onerel, double totalrows, MemoryContext cxt; MemoryContext oldcxt; + /* don't build stats for inheritance trees for now */ + if (inh) + return; + cxt = AllocSetContextCreate(CurrentMemoryContext, "BuildRelationExtStatistics", ALLOCSET_DEFAULT_SIZES); diff --git a/src/include/statistics/statistics.h b/src/include/statistics/statistics.h index cb7bc630e9..880fc32056 100644 --- a/src/include/statistics/statistics.h +++ b/src/include/statistics/statistics.h @@ -97,7 +97,7 @@ extern MVNDistinct *statext_ndistinct_load(Oid mvoid); extern MVDependencies *statext_dependencies_load(Oid mvoid); extern MCVList *statext_mcv_load(Oid mvoid); -extern void BuildRelationExtStatistics(Relation onerel, double totalrows, +extern void BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows, int numrows, HeapTuple *rows, int natts, VacAttrStats **vacattrstats); extern bool statext_is_kind_built(HeapTuple htup, char kind); -- 2.20.1