summaryrefslogtreecommitdiff
path: root/src/backend/statistics/dependencies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/statistics/dependencies.c')
-rw-r--r--src/backend/statistics/dependencies.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c
index 12f58e0ffd0..6e484f62bea 100644
--- a/src/backend/statistics/dependencies.c
+++ b/src/backend/statistics/dependencies.c
@@ -967,10 +967,13 @@ dependencies_clauselist_selectivity(PlannerInfo *root,
RangeTblEntry *rte = planner_rt_fetch(rel->relid, root);
/*
- * When dealing with inheritance trees, ignore extended stats (which were
- * built without data from child rels, and thus do not represent them).
+ * When dealing with regular inheritance trees, ignore extended stats
+ * (which were built without data from child rels, and thus do not
+ * represent them). For partitioned tables data there's no data in the
+ * non-leaf relations, so we build stats only for the inheritance tree.
+ * So for partitioned tables we do consider extended stats.
*/
- if (rte->inh)
+ if (rte->inh && rte->relkind != RELKIND_PARTITIONED_TABLE)
return 1.0;
/* check if there's any stats that might be useful for us. */