Enable push down only for reference table

onur-leftjoin_push-improvements
eaydingol 2025-07-25 14:18:23 +03:00
parent c08c1eb299
commit cd9f6ae313
1 changed files with 3 additions and 16 deletions

View File

@ -2658,34 +2658,21 @@ hasPseudoconstantQuals(RelationRestrictionContext *relationRestrictionContext)
/* /*
* IsPushdownSafeForRTEInLeftJoin returns true if the given range table entry * IsPushdownSafeForRTEInLeftJoin returns true if the given range table entry
* is safe for pushdown. Currently, we only allow RTE_RELATION and RTE_FUNCTION. * is safe for pushdown. Currently, we only allow reference tables.
*/ */
bool IsPushdownSafeForRTEInLeftJoin(RangeTblEntry *rte) bool IsPushdownSafeForRTEInLeftJoin(RangeTblEntry *rte)
{ {
if (rte->rtekind == RTE_RELATION) if (IsCitusTable(rte->relid) && IsCitusTableType(rte->relid, REFERENCE_TABLE))
{ {
return true; return true;
} }
/* check if it is a citus table, e.g., ref table */
else if (rte->rtekind == RTE_FUNCTION)
{
RangeTblEntry *newRte = NULL;
if(!ExtractCitusExtradataContainerRTE(rte, &newRte))
{
ereport(DEBUG5, (errmsg("RTE type %d is not safe for pushdown, function but it does not contain citus extradata",
rte->rtekind)));
return false;
}
return true;
}
else else
{ {
ereport(DEBUG5, (errmsg("RTE type %d is not safe for pushdown", ereport(DEBUG5, (errmsg("RTE type %d is not safe for pushdown",
rte->rtekind))); rte->rtekind)));
return false; return false;
} }
} }