diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/executor/nodeMemoize.h | 32 | ||||
-rw-r--r-- | src/include/executor/nodeResultCache.h | 32 | ||||
-rw-r--r-- | src/include/nodes/execnodes.h | 48 | ||||
-rw-r--r-- | src/include/nodes/nodes.h | 6 | ||||
-rw-r--r-- | src/include/nodes/pathnodes.h | 12 | ||||
-rw-r--r-- | src/include/nodes/plannodes.h | 6 | ||||
-rw-r--r-- | src/include/optimizer/cost.h | 2 | ||||
-rw-r--r-- | src/include/optimizer/pathnode.h | 14 |
8 files changed, 76 insertions, 76 deletions
diff --git a/src/include/executor/nodeMemoize.h b/src/include/executor/nodeMemoize.h new file mode 100644 index 00000000000..898fa438163 --- /dev/null +++ b/src/include/executor/nodeMemoize.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * nodeMemoize.h + * + * + * + * Portions Copyright (c) 2021, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMemoize.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMEMOIZE_H +#define NODEMEMOIZE_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern MemoizeState *ExecInitMemoize(Memoize *node, EState *estate, int eflags); +extern void ExecEndMemoize(MemoizeState *node); +extern void ExecReScanMemoize(MemoizeState *node); +extern double ExecEstimateCacheEntryOverheadBytes(double ntuples); +extern void ExecMemoizeEstimate(MemoizeState *node, + ParallelContext *pcxt); +extern void ExecMemoizeInitializeDSM(MemoizeState *node, + ParallelContext *pcxt); +extern void ExecMemoizeInitializeWorker(MemoizeState *node, + ParallelWorkerContext *pwcxt); +extern void ExecMemoizeRetrieveInstrumentation(MemoizeState *node); + +#endif /* NODEMEMOIZE_H */ diff --git a/src/include/executor/nodeResultCache.h b/src/include/executor/nodeResultCache.h deleted file mode 100644 index e7a3e7ab9cd..00000000000 --- a/src/include/executor/nodeResultCache.h +++ /dev/null @@ -1,32 +0,0 @@ -/*------------------------------------------------------------------------- - * - * nodeResultCache.h - * - * - * - * Portions Copyright (c) 2021, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * src/include/executor/nodeResultCache.h - * - *------------------------------------------------------------------------- - */ -#ifndef NODERESULTCACHE_H -#define NODERESULTCACHE_H - -#include "access/parallel.h" -#include "nodes/execnodes.h" - -extern ResultCacheState *ExecInitResultCache(ResultCache *node, EState *estate, int eflags); -extern void ExecEndResultCache(ResultCacheState *node); -extern void ExecReScanResultCache(ResultCacheState *node); -extern double ExecEstimateCacheEntryOverheadBytes(double ntuples); -extern void ExecResultCacheEstimate(ResultCacheState *node, - ParallelContext *pcxt); -extern void ExecResultCacheInitializeDSM(ResultCacheState *node, - ParallelContext *pcxt); -extern void ExecResultCacheInitializeWorker(ResultCacheState *node, - ParallelWorkerContext *pwcxt); -extern void ExecResultCacheRetrieveInstrumentation(ResultCacheState *node); - -#endif /* NODERESULTCACHE_H */ diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 0ec5509e7e9..105180764e1 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -2046,11 +2046,11 @@ typedef struct MaterialState Tuplestorestate *tuplestorestate; } MaterialState; -struct ResultCacheEntry; -struct ResultCacheTuple; -struct ResultCacheKey; +struct MemoizeEntry; +struct MemoizeTuple; +struct MemoizeKey; -typedef struct ResultCacheInstrumentation +typedef struct MemoizeInstrumentation { uint64 cache_hits; /* number of rescans where we've found the * scan parameter values to be cached */ @@ -2063,31 +2063,31 @@ typedef struct ResultCacheInstrumentation * able to free enough space to store the * current scan's tuples. */ uint64 mem_peak; /* peak memory usage in bytes */ -} ResultCacheInstrumentation; +} MemoizeInstrumentation; /* ---------------- - * Shared memory container for per-worker resultcache information + * Shared memory container for per-worker memoize information * ---------------- */ -typedef struct SharedResultCacheInfo +typedef struct SharedMemoizeInfo { int num_workers; - ResultCacheInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; -} SharedResultCacheInfo; + MemoizeInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedMemoizeInfo; /* ---------------- - * ResultCacheState information + * MemoizeState information * - * resultcache nodes are used to cache recent and commonly seen results - * from a parameterized scan. + * memoize nodes are used to cache recent and commonly seen results from + * a parameterized scan. * ---------------- */ -typedef struct ResultCacheState +typedef struct MemoizeState { ScanState ss; /* its first field is NodeTag */ - int rc_status; /* value of ExecResultCache state machine */ + int mstatus; /* value of ExecMemoize state machine */ int nkeys; /* number of cache keys */ - struct resultcache_hash *hashtable; /* hash table for cache entries */ + struct memoize_hash *hashtable; /* hash table for cache entries */ TupleDesc hashkeydesc; /* tuple descriptor for cache keys */ TupleTableSlot *tableslot; /* min tuple slot for existing cache entries */ TupleTableSlot *probeslot; /* virtual slot used for hash lookups */ @@ -2100,17 +2100,17 @@ typedef struct ResultCacheState uint64 mem_limit; /* memory limit in bytes for the cache */ MemoryContext tableContext; /* memory context to store cache data */ dlist_head lru_list; /* least recently used entry list */ - struct ResultCacheTuple *last_tuple; /* Used to point to the last tuple - * returned during a cache hit and - * the tuple we last stored when - * populating the cache. */ - struct ResultCacheEntry *entry; /* the entry that 'last_tuple' belongs to - * or NULL if 'last_tuple' is NULL. */ + struct MemoizeTuple *last_tuple; /* Used to point to the last tuple + * returned during a cache hit and the + * tuple we last stored when + * populating the cache. */ + struct MemoizeEntry *entry; /* the entry that 'last_tuple' belongs to or + * NULL if 'last_tuple' is NULL. */ bool singlerow; /* true if the cache entry is to be marked as * complete after caching the first tuple. */ - ResultCacheInstrumentation stats; /* execution statistics */ - SharedResultCacheInfo *shared_info; /* statistics for parallel workers */ -} ResultCacheState; + MemoizeInstrumentation stats; /* execution statistics */ + SharedMemoizeInfo *shared_info; /* statistics for parallel workers */ +} MemoizeState; /* ---------------- * When performing sorting by multiple keys, it's possible that the input diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index d9e417bcd70..f7b009ec43b 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -74,7 +74,7 @@ typedef enum NodeTag T_MergeJoin, T_HashJoin, T_Material, - T_ResultCache, + T_Memoize, T_Sort, T_IncrementalSort, T_Group, @@ -133,7 +133,7 @@ typedef enum NodeTag T_MergeJoinState, T_HashJoinState, T_MaterialState, - T_ResultCacheState, + T_MemoizeState, T_SortState, T_IncrementalSortState, T_GroupState, @@ -244,7 +244,7 @@ typedef enum NodeTag T_MergeAppendPath, T_GroupResultPath, T_MaterialPath, - T_ResultCachePath, + T_MemoizePath, T_UniquePath, T_GatherPath, T_GatherMergePath, diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index b7b2817a5de..e884f3c9dc8 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -1495,11 +1495,11 @@ typedef struct MaterialPath } MaterialPath; /* - * ResultCachePath represents a ResultCache plan node, i.e., a cache that - * caches tuples from parameterized paths to save the underlying node from - * having to be rescanned for parameter values which are already cached. + * MemoizePath represents a Memoize plan node, i.e., a cache that caches + * tuples from parameterized paths to save the underlying node from having to + * be rescanned for parameter values which are already cached. */ -typedef struct ResultCachePath +typedef struct MemoizePath { Path path; Path *subpath; /* outerpath to cache tuples from */ @@ -1511,7 +1511,7 @@ typedef struct ResultCachePath uint32 est_entries; /* The maximum number of entries that the * planner expects will fit in the cache, or 0 * if unknown */ -} ResultCachePath; +} MemoizePath; /* * UniquePath represents elimination of distinct rows from the output of @@ -2111,7 +2111,7 @@ typedef struct RestrictInfo Selectivity left_mcvfreq; /* left side's most common val's freq */ Selectivity right_mcvfreq; /* right side's most common val's freq */ - /* hash equality operator used for result cache, else InvalidOid */ + /* hash equality operator used for memoize nodes, else InvalidOid */ Oid hasheqoperator; } RestrictInfo; diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index aaa3b65d049..98a4c73f939 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -781,10 +781,10 @@ typedef struct Material } Material; /* ---------------- - * result cache node + * memoize node * ---------------- */ -typedef struct ResultCache +typedef struct Memoize { Plan plan; @@ -799,7 +799,7 @@ typedef struct ResultCache uint32 est_entries; /* The maximum number of entries that the * planner expects will fit in the cache, or 0 * if unknown */ -} ResultCache; +} Memoize; /* ---------------- * sort node diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 0fe60d82e43..2113bc82de0 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -57,7 +57,7 @@ extern PGDLLIMPORT bool enable_incremental_sort; extern PGDLLIMPORT bool enable_hashagg; extern PGDLLIMPORT bool enable_nestloop; extern PGDLLIMPORT bool enable_material; -extern PGDLLIMPORT bool enable_resultcache; +extern PGDLLIMPORT bool enable_memoize; extern PGDLLIMPORT bool enable_mergejoin; extern PGDLLIMPORT bool enable_hashjoin; extern PGDLLIMPORT bool enable_gathermerge; diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index 53261ee91fd..f704d399809 100644 --- a/src/include/optimizer/pathnode.h +++ b/src/include/optimizer/pathnode.h @@ -82,13 +82,13 @@ extern GroupResultPath *create_group_result_path(PlannerInfo *root, PathTarget *target, List *havingqual); extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath); -extern ResultCachePath *create_resultcache_path(PlannerInfo *root, - RelOptInfo *rel, - Path *subpath, - List *param_exprs, - List *hash_operators, - bool singlerow, - double calls); +extern MemoizePath *create_memoize_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *param_exprs, + List *hash_operators, + bool singlerow, + double calls); extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo); extern GatherPath *create_gather_path(PlannerInfo *root, |