mirror of https://github.com/citusdata/citus.git
Undo planner extended statistics override (#6492)
parent
a1aa96b32c
commit
eb75decbeb
|
@ -1940,37 +1940,17 @@ multi_relation_restriction_hook(PlannerInfo *root, RelOptInfo *relOptInfo,
|
||||||
{
|
{
|
||||||
cacheEntry = GetCitusTableCacheEntry(rte->relid);
|
cacheEntry = GetCitusTableCacheEntry(rte->relid);
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM == PG_VERSION_15
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The statistics objects of the distributed table are not relevant
|
* Postgres 15.0 had a bug regarding inherited statistics expressions,
|
||||||
* for the distributed planning, so we can override it.
|
* which is fixed in 15.1 via Postgres commit
|
||||||
|
* 1f1865e9083625239769c26f68b9c2861b8d4b1c.
|
||||||
*
|
*
|
||||||
* Normally, we should not need this. However, the combination of
|
* Hence, we only set this value on exactly PG15.0
|
||||||
* Postgres commit 269b532aef55a579ae02a3e8e8df14101570dfd9 and
|
|
||||||
* Citus function AdjustPartitioningForDistributedPlanning()
|
|
||||||
* forces us to do this. The commit expects statistics objects
|
|
||||||
* of partitions to have "inh" flag set properly. Whereas, the
|
|
||||||
* function overrides "inh" flag. To avoid Postgres to throw error,
|
|
||||||
* we override statlist such that Postgres does not try to process
|
|
||||||
* any statistics objects during the standard_planner() on the
|
|
||||||
* coordinator. In the end, we do not need the standard_planner()
|
|
||||||
* on the coordinator to generate an optimized plan. We call
|
|
||||||
* into standard_planner() for other purposes, such as generating the
|
|
||||||
* relationRestrictionContext here.
|
|
||||||
*
|
|
||||||
* AdjustPartitioningForDistributedPlanning() is a hack that we use
|
|
||||||
* to prevent Postgres' standard_planner() to expand all the partitions
|
|
||||||
* for the distributed planning when a distributed partitioned table
|
|
||||||
* is queried. It is required for both correctness and performance
|
|
||||||
* reasons. Although we can eliminate the use of the function for
|
|
||||||
* the correctness (e.g., make sure that rest of the planner can handle
|
|
||||||
* partitions), it's performance implication is hard to avoid. Certain
|
|
||||||
* planning logic of Citus (such as router or query pushdown) relies
|
|
||||||
* heavily on the relationRestrictionList. If
|
|
||||||
* AdjustPartitioningForDistributedPlanning() is removed, all the
|
|
||||||
* partitions show up in the, causing high planning times for
|
|
||||||
* such queries.
|
|
||||||
*/
|
*/
|
||||||
relOptInfo->statlist = NIL;
|
relOptInfo->statlist = NIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
relationRestrictionContext->allReferenceTables &=
|
relationRestrictionContext->allReferenceTables &=
|
||||||
IsCitusTableTypeCacheEntry(cacheEntry, REFERENCE_TABLE);
|
IsCitusTableTypeCacheEntry(cacheEntry, REFERENCE_TABLE);
|
||||||
|
|
Loading…
Reference in New Issue