mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Revert b6002a796
This removes "Add Result Cache executor node". It seems that something weird is going on with the tracking of cache hits and misses as highlighted by many buildfarm animals. It's not yet clear what the problem is as other parts of the plan indicate that the cache did work correctly, it's just the hits and misses that were being reported as 0. This is especially a bad time to have the buildfarm so broken, so reverting before too many more animals go red. Discussion: https://postgr.es/m/CAApHDvq_hydhfovm4=izgWs+C5HqEeRScjMbOgbpC-jRAeK3Yw@mail.gmail.com
This commit is contained in:
@@ -91,9 +91,6 @@ static Result *create_group_result_plan(PlannerInfo *root,
|
||||
static ProjectSet *create_project_set_plan(PlannerInfo *root, ProjectSetPath *best_path);
|
||||
static Material *create_material_plan(PlannerInfo *root, MaterialPath *best_path,
|
||||
int flags);
|
||||
static ResultCache *create_resultcache_plan(PlannerInfo *root,
|
||||
ResultCachePath *best_path,
|
||||
int flags);
|
||||
static Plan *create_unique_plan(PlannerInfo *root, UniquePath *best_path,
|
||||
int flags);
|
||||
static Gather *create_gather_plan(PlannerInfo *root, GatherPath *best_path);
|
||||
@@ -280,11 +277,6 @@ static Sort *make_sort_from_groupcols(List *groupcls,
|
||||
AttrNumber *grpColIdx,
|
||||
Plan *lefttree);
|
||||
static Material *make_material(Plan *lefttree);
|
||||
static ResultCache *make_resultcache(Plan *lefttree, Oid *hashoperators,
|
||||
Oid *collations,
|
||||
List *param_exprs,
|
||||
bool singlerow,
|
||||
uint32 est_entries);
|
||||
static WindowAgg *make_windowagg(List *tlist, Index winref,
|
||||
int partNumCols, AttrNumber *partColIdx, Oid *partOperators, Oid *partCollations,
|
||||
int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, Oid *ordCollations,
|
||||
@@ -461,11 +453,6 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
(MaterialPath *) best_path,
|
||||
flags);
|
||||
break;
|
||||
case T_ResultCache:
|
||||
plan = (Plan *) create_resultcache_plan(root,
|
||||
(ResultCachePath *) best_path,
|
||||
flags);
|
||||
break;
|
||||
case T_Unique:
|
||||
if (IsA(best_path, UpperUniquePath))
|
||||
{
|
||||
@@ -1579,56 +1566,6 @@ create_material_plan(PlannerInfo *root, MaterialPath *best_path, int flags)
|
||||
return plan;
|
||||
}
|
||||
|
||||
/*
|
||||
* create_resultcache_plan
|
||||
* Create a ResultCache plan for 'best_path' and (recursively) plans
|
||||
* for its subpaths.
|
||||
*
|
||||
* Returns a Plan node.
|
||||
*/
|
||||
static ResultCache *
|
||||
create_resultcache_plan(PlannerInfo *root, ResultCachePath *best_path, int flags)
|
||||
{
|
||||
ResultCache *plan;
|
||||
Plan *subplan;
|
||||
Oid *operators;
|
||||
Oid *collations;
|
||||
List *param_exprs = NIL;
|
||||
ListCell *lc;
|
||||
ListCell *lc2;
|
||||
int nkeys;
|
||||
int i;
|
||||
|
||||
subplan = create_plan_recurse(root, best_path->subpath,
|
||||
flags | CP_SMALL_TLIST);
|
||||
|
||||
param_exprs = (List *) replace_nestloop_params(root, (Node *)
|
||||
best_path->param_exprs);
|
||||
|
||||
nkeys = list_length(param_exprs);
|
||||
Assert(nkeys > 0);
|
||||
operators = palloc(nkeys * sizeof(Oid));
|
||||
collations = palloc(nkeys * sizeof(Oid));
|
||||
|
||||
i = 0;
|
||||
forboth(lc, param_exprs, lc2, best_path->hash_operators)
|
||||
{
|
||||
Expr *param_expr = (Expr *) lfirst(lc);
|
||||
Oid opno = lfirst_oid(lc2);
|
||||
|
||||
operators[i] = opno;
|
||||
collations[i] = exprCollation((Node *) param_expr);
|
||||
i++;
|
||||
}
|
||||
|
||||
plan = make_resultcache(subplan, operators, collations, param_exprs,
|
||||
best_path->singlerow, best_path->est_entries);
|
||||
|
||||
copy_generic_path_info(&plan->plan, (Path *) best_path);
|
||||
|
||||
return plan;
|
||||
}
|
||||
|
||||
/*
|
||||
* create_unique_plan
|
||||
* Create a Unique plan for 'best_path' and (recursively) plans
|
||||
@@ -6515,28 +6452,6 @@ materialize_finished_plan(Plan *subplan)
|
||||
return matplan;
|
||||
}
|
||||
|
||||
static ResultCache *
|
||||
make_resultcache(Plan *lefttree, Oid *hashoperators, Oid *collations,
|
||||
List *param_exprs, bool singlerow, uint32 est_entries)
|
||||
{
|
||||
ResultCache *node = makeNode(ResultCache);
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
plan->targetlist = lefttree->targetlist;
|
||||
plan->qual = NIL;
|
||||
plan->lefttree = lefttree;
|
||||
plan->righttree = NULL;
|
||||
|
||||
node->numKeys = list_length(param_exprs);
|
||||
node->hashOperators = hashoperators;
|
||||
node->collations = collations;
|
||||
node->param_exprs = param_exprs;
|
||||
node->singlerow = singlerow;
|
||||
node->est_entries = est_entries;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
Agg *
|
||||
make_agg(List *tlist, List *qual,
|
||||
AggStrategy aggstrategy, AggSplit aggsplit,
|
||||
@@ -7123,7 +7038,6 @@ is_projection_capable_path(Path *path)
|
||||
{
|
||||
case T_Hash:
|
||||
case T_Material:
|
||||
case T_ResultCache:
|
||||
case T_Sort:
|
||||
case T_IncrementalSort:
|
||||
case T_Unique:
|
||||
@@ -7169,7 +7083,6 @@ is_projection_capable_plan(Plan *plan)
|
||||
{
|
||||
case T_Hash:
|
||||
case T_Material:
|
||||
case T_ResultCache:
|
||||
case T_Sort:
|
||||
case T_Unique:
|
||||
case T_SetOp:
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include "parser/analyze.h"
|
||||
#include "rewrite/rewriteManip.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/typcache.h"
|
||||
|
||||
/* These parameters are set by GUC */
|
||||
int from_collapse_limit;
|
||||
@@ -78,7 +77,6 @@ static bool check_equivalence_delay(PlannerInfo *root,
|
||||
static bool check_redundant_nullability_qual(PlannerInfo *root, Node *clause);
|
||||
static void check_mergejoinable(RestrictInfo *restrictinfo);
|
||||
static void check_hashjoinable(RestrictInfo *restrictinfo);
|
||||
static void check_resultcacheable(RestrictInfo *restrictinfo);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -2210,13 +2208,6 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
|
||||
*/
|
||||
check_hashjoinable(restrictinfo);
|
||||
|
||||
/*
|
||||
* Likewise, check if the clause is suitable to be used with a
|
||||
* Result Cache node to cache inner tuples during a parameterized
|
||||
* nested loop.
|
||||
*/
|
||||
check_resultcacheable(restrictinfo);
|
||||
|
||||
/*
|
||||
* Add clause to the join lists of all the relevant relations.
|
||||
*/
|
||||
@@ -2459,7 +2450,6 @@ build_implied_join_equality(PlannerInfo *root,
|
||||
/* Set mergejoinability/hashjoinability flags */
|
||||
check_mergejoinable(restrictinfo);
|
||||
check_hashjoinable(restrictinfo);
|
||||
check_resultcacheable(restrictinfo);
|
||||
|
||||
return restrictinfo;
|
||||
}
|
||||
@@ -2707,34 +2697,3 @@ check_hashjoinable(RestrictInfo *restrictinfo)
|
||||
!contain_volatile_functions((Node *) restrictinfo))
|
||||
restrictinfo->hashjoinoperator = opno;
|
||||
}
|
||||
|
||||
/*
|
||||
* check_resultcacheable
|
||||
* If the restrictinfo's clause is suitable to be used for a Result Cache
|
||||
* node, set the hasheqoperator to the hash equality operator that will be
|
||||
* needed during caching.
|
||||
*/
|
||||
static void
|
||||
check_resultcacheable(RestrictInfo *restrictinfo)
|
||||
{
|
||||
TypeCacheEntry *typentry;
|
||||
Expr *clause = restrictinfo->clause;
|
||||
Node *leftarg;
|
||||
|
||||
if (restrictinfo->pseudoconstant)
|
||||
return;
|
||||
if (!is_opclause(clause))
|
||||
return;
|
||||
if (list_length(((OpExpr *) clause)->args) != 2)
|
||||
return;
|
||||
|
||||
leftarg = linitial(((OpExpr *) clause)->args);
|
||||
|
||||
typentry = lookup_type_cache(exprType(leftarg), TYPECACHE_HASH_PROC |
|
||||
TYPECACHE_EQ_OPR);
|
||||
|
||||
if (!OidIsValid(typentry->hash_proc) || !OidIsValid(typentry->eq_opr))
|
||||
return;
|
||||
|
||||
restrictinfo->hasheqoperator = typentry->eq_opr;
|
||||
}
|
||||
|
@@ -752,15 +752,6 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
|
||||
set_hash_references(root, plan, rtoffset);
|
||||
break;
|
||||
|
||||
case T_ResultCache:
|
||||
{
|
||||
ResultCache *rcplan = (ResultCache *) plan;
|
||||
rcplan->param_exprs = fix_scan_list(root, rcplan->param_exprs,
|
||||
rtoffset,
|
||||
NUM_EXEC_TLIST(plan));
|
||||
break;
|
||||
}
|
||||
|
||||
case T_Material:
|
||||
case T_Sort:
|
||||
case T_IncrementalSort:
|
||||
|
@@ -2745,11 +2745,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
||||
/* rescan_param does *not* get added to scan_params */
|
||||
break;
|
||||
|
||||
case T_ResultCache:
|
||||
finalize_primnode((Node *) ((ResultCache *) plan)->param_exprs,
|
||||
&context);
|
||||
break;
|
||||
|
||||
case T_ProjectSet:
|
||||
case T_Hash:
|
||||
case T_Material:
|
||||
|
Reference in New Issue
Block a user