MCPcopy Create free account
hub / github.com/apache/cloudberry / create_memoize_path

Function create_memoize_path

src/backend/optimizer/util/pathnode.c:2276–2321  ·  view source on GitHub ↗

* create_memoize_path * Creates a path corresponding to a Memoize plan, returning the pathnode. */

Source from the content-addressed store, hash-verified

2274 * Creates a path corresponding to a Memoize plan, returning the pathnode.
2275 */
2276MemoizePath *
2277create_memoize_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
2278 List *param_exprs, List *hash_operators,
2279 bool singlerow, bool binary_mode, double calls)
2280{
2281 MemoizePath *pathnode = makeNode(MemoizePath);
2282
2283 Assert(subpath->parent == rel);
2284
2285 pathnode->path.pathtype = T_Memoize;
2286 pathnode->path.parent = rel;
2287 pathnode->path.pathtarget = rel->reltarget;
2288 pathnode->path.param_info = subpath->param_info;
2289 pathnode->path.parallel_aware = false;
2290 pathnode->path.parallel_safe = rel->consider_parallel &&
2291 subpath->parallel_safe;
2292 pathnode->path.parallel_workers = subpath->parallel_workers;
2293 pathnode->path.pathkeys = subpath->pathkeys;
2294 pathnode->path.rescannable = subpath->rescannable;
2295
2296 pathnode->path.locus = subpath->locus;
2297 pathnode->subpath = subpath;
2298 pathnode->hash_operators = hash_operators;
2299 pathnode->param_exprs = param_exprs;
2300 pathnode->singlerow = singlerow;
2301 pathnode->binary_mode = binary_mode;
2302 pathnode->calls = calls;
2303
2304 /*
2305 * For now we set est_entries to 0. cost_memoize_rescan() does all the
2306 * hard work to determine how many cache entries there are likely to be,
2307 * so it seems best to leave it up to that function to fill this field in.
2308 * If left at 0, the executor will make a guess at a good value.
2309 */
2310 pathnode->est_entries = 0;
2311
2312 /*
2313 * Add a small additional charge for caching the first entry. All the
2314 * harder calculations for rescans are performed in cost_memoize_rescan().
2315 */
2316 pathnode->path.startup_cost = subpath->startup_cost + cpu_tuple_cost;
2317 pathnode->path.total_cost = subpath->total_cost + cpu_tuple_cost;
2318 pathnode->path.rows = subpath->rows;
2319
2320 return pathnode;
2321}
2322
2323/*
2324 * create_unique_path

Callers 2

get_memoize_pathFunction · 0.85
reparameterize_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected