aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/pathnode.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2021-07-14 12:45:00 +1200
committerDavid Rowley <drowley@postgresql.org>2021-07-14 12:45:00 +1200
commit47ca4836441d1c24f75a94d43af8bd72d4c8d057 (patch)
treec04f184de05c3439eb2579fd6e4f27bebbd6402e /src/backend/optimizer/util/pathnode.c
parent6201fa3c166fe2383dd44a9dd5082bc748c2937a (diff)
downloadpostgresql-47ca4836441d1c24f75a94d43af8bd72d4c8d057.tar.gz
postgresql-47ca4836441d1c24f75a94d43af8bd72d4c8d057.zip
Change the name of the Result Cache node to Memoize
"Result Cache" was never a great name for this node, but nobody managed to come up with another name that anyone liked enough. That was until David Johnston mentioned "Node Memoization", which Tom Lane revised to just "Memoize". People seem to like "Memoize", so let's do the rename. Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/20210708165145.GG1176@momjian.us Backpatch-through: 14, where Result Cache was introduced
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r--src/backend/optimizer/util/pathnode.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 9ce5f95e3b1..0c94cbe767a 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -1577,20 +1577,19 @@ create_material_path(RelOptInfo *rel, Path *subpath)
}
/*
- * create_resultcache_path
- * Creates a path corresponding to a ResultCache plan, returning the
- * pathnode.
+ * create_memoize_path
+ * Creates a path corresponding to a Memoize plan, returning the pathnode.
*/
-ResultCachePath *
-create_resultcache_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
- List *param_exprs, List *hash_operators,
- bool singlerow, double calls)
+MemoizePath *
+create_memoize_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
+ List *param_exprs, List *hash_operators,
+ bool singlerow, double calls)
{
- ResultCachePath *pathnode = makeNode(ResultCachePath);
+ MemoizePath *pathnode = makeNode(MemoizePath);
Assert(subpath->parent == rel);
- pathnode->path.pathtype = T_ResultCache;
+ pathnode->path.pathtype = T_Memoize;
pathnode->path.parent = rel;
pathnode->path.pathtarget = rel->reltarget;
pathnode->path.param_info = subpath->param_info;
@@ -1607,17 +1606,16 @@ create_resultcache_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
pathnode->calls = calls;
/*
- * For now we set est_entries to 0. cost_resultcache_rescan() does all
- * the hard work to determine how many cache entries there are likely to
- * be, so it seems best to leave it up to that function to fill this field
- * in. If left at 0, the executor will make a guess at a good value.
+ * For now we set est_entries to 0. cost_memoize_rescan() does all the
+ * hard work to determine how many cache entries there are likely to be,
+ * so it seems best to leave it up to that function to fill this field in.
+ * If left at 0, the executor will make a guess at a good value.
*/
pathnode->est_entries = 0;
/*
* Add a small additional charge for caching the first entry. All the
- * harder calculations for rescans are performed in
- * cost_resultcache_rescan().
+ * harder calculations for rescans are performed in cost_memoize_rescan().
*/
pathnode->path.startup_cost = subpath->startup_cost + cpu_tuple_cost;
pathnode->path.total_cost = subpath->total_cost + cpu_tuple_cost;
@@ -3936,16 +3934,16 @@ reparameterize_path(PlannerInfo *root, Path *path,
apath->path.parallel_aware,
-1);
}
- case T_ResultCache:
+ case T_Memoize:
{
- ResultCachePath *rcpath = (ResultCachePath *) path;
-
- return (Path *) create_resultcache_path(root, rel,
- rcpath->subpath,
- rcpath->param_exprs,
- rcpath->hash_operators,
- rcpath->singlerow,
- rcpath->calls);
+ MemoizePath *mpath = (MemoizePath *) path;
+
+ return (Path *) create_memoize_path(root, rel,
+ mpath->subpath,
+ mpath->param_exprs,
+ mpath->hash_operators,
+ mpath->singlerow,
+ mpath->calls);
}
default:
break;
@@ -4165,13 +4163,13 @@ do { \
}
break;
- case T_ResultCachePath:
+ case T_MemoizePath:
{
- ResultCachePath *rcpath;
+ MemoizePath *mpath;
- FLAT_COPY_PATH(rcpath, path, ResultCachePath);
- REPARAMETERIZE_CHILD_PATH(rcpath->subpath);
- new_path = (Path *) rcpath;
+ FLAT_COPY_PATH(mpath, path, MemoizePath);
+ REPARAMETERIZE_CHILD_PATH(mpath->subpath);
+ new_path = (Path *) mpath;
}
break;