|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <limits.h>#include "access/transam.h"#include "catalog/namespace.h"#include "executor/executor.h"#include "miscadmin.h"#include "nodes/nodeFuncs.h"#include "optimizer/optimizer.h"#include "parser/analyze.h"#include "rewrite/rewriteHandler.h"#include "storage/lmgr.h"#include "tcop/pquery.h"#include "tcop/utility.h"#include "utils/inval.h"#include "utils/memutils.h"#include "utils/resowner.h"#include "utils/rls.h"#include "utils/snapmgr.h"#include "utils/syscache.h"
Go to the source code of this file.
Variables | |
| static dlist_head | saved_plan_list = DLIST_STATIC_INIT(saved_plan_list) |
| static dlist_head | cached_expression_list = DLIST_STATIC_INIT(cached_expression_list) |
| static const ResourceOwnerDesc | planref_resowner_desc |
| int | plan_cache_mode = PLAN_CACHE_MODE_AUTO |
Definition at line 1909 of file plancache.c.
References CMD_UTILITY, PlannedStmt::commandType, fb(), lfirst, lfirst_node, LockRelationOid(), OidIsValid, PlannedStmt::rtable, RTE_RELATION, RTE_SUBQUERY, ScanQueryForLocks(), UnlockRelationOid(), UtilityContainsQuery(), and PlannedStmt::utilityStmt.
Referenced by CheckCachedPlan().
Definition at line 1965 of file plancache.c.
References CMD_UTILITY, Query::commandType, fb(), lfirst_node, ScanQueryForLocks(), UtilityContainsQuery(), and Query::utilityStmt.
Referenced by RevalidateCachedQuery().
|
static |
Definition at line 1034 of file plancache.c.
References ActiveSnapshotSet(), ALLOCSET_START_SMALL_SIZES, AllocSetContextCreate, Assert, BuildingPlanRequiresSnapshot(), CACHEDPLAN_MAGIC, CMD_UTILITY, PlannedStmt::commandType, copyObject, CurrentMemoryContext, CachedPlanSource::cursor_options, CachedPlanSource::dependsOnRLS, PlannedStmt::dependsOnRole, fb(), CachedPlanSource::generation, GetTransactionSnapshot(), GetUserId(), InvalidTransactionId, CachedPlanSource::is_oneshot, CachedPlanSource::is_valid, lfirst_node, MemoryContextCopyAndSetIdentifier, MemoryContextSwitchTo(), NIL, palloc_object, pg_plan_queries(), plan, PopActiveSnapshot(), PushActiveSnapshot(), CachedPlanSource::query_list, CachedPlanSource::query_string, RevalidateCachedQuery(), TransactionIdIsNormal, TransactionXmin, and PlannedStmt::transientPlan.
Referenced by GetCachedPlan().
|
static |
Definition at line 657 of file plancache.c.
References analyze_requires_snapshot(), CachedPlanSource::analyzed_parse_tree, fb(), query_requires_rewrite_plan(), and CachedPlanSource::raw_parse_tree.
Referenced by BuildCachedPlan().
|
static |
Definition at line 1230 of file plancache.c.
References CMD_UTILITY, PlannedStmt::commandType, cpu_operator_cost, fb(), lfirst_node, list_length(), plan, PlannedStmt::planTree, PlannedStmt::rtable, and Plan::total_cost.
Referenced by GetCachedPlan().
| bool CachedPlanAllowsSimpleValidityCheck | ( | CachedPlanSource * | plansource, |
| CachedPlan * | plan, | ||
| ResourceOwner | owner | ||
| ) |
Definition at line 1471 of file plancache.c.
References Assert, CACHEDPLAN_MAGIC, CACHEDPLANSOURCE_MAGIC, CMD_UTILITY, Query::commandType, PlannedStmt::commandType, Query::cteList, CachedPlanSource::dependsOnRLS, fb(), CachedPlanSource::gplan, CachedPlanSource::is_oneshot, lfirst, lfirst_node, CachedPlanSource::magic, plan, CachedPlanSource::query_list, ResourceOwnerEnlarge(), ResourceOwnerRememberPlanCacheRef(), Query::rtable, PlannedStmt::rtable, RTE_RELATION, CachedPlanSource::search_path, SearchPathMatchesCurrentEnvironment(), and TransactionIdIsValid.
Referenced by exec_eval_simple_expr(), and exec_simple_check_plan().
| List * CachedPlanGetTargetList | ( | CachedPlanSource * | plansource, |
| QueryEnvironment * | queryEnv | ||
| ) |
Definition at line 1777 of file plancache.c.
References Assert, CACHEDPLANSOURCE_MAGIC, fb(), FetchStatementTargetList(), CachedPlanSource::is_complete, CachedPlanSource::magic, NIL, CachedPlanSource::query_list, QueryListGetPrimaryStmt(), CachedPlanSource::resultDesc, and RevalidateCachedQuery().
Referenced by exec_describe_statement_message(), and FetchPreparedStatementTargetList().
| bool CachedPlanIsSimplyValid | ( | CachedPlanSource * | plansource, |
| CachedPlan * | plan, | ||
| ResourceOwner | owner | ||
| ) |
Definition at line 1586 of file plancache.c.
References Assert, CACHEDPLAN_MAGIC, CACHEDPLANSOURCE_MAGIC, fb(), CachedPlanSource::gplan, CachedPlanSource::is_valid, CachedPlan::is_valid, CachedPlanSource::magic, plan, ResourceOwnerEnlarge(), ResourceOwnerRememberPlanCacheRef(), CachedPlanSource::search_path, and SearchPathMatchesCurrentEnvironment().
Referenced by exec_eval_simple_expr().
| bool CachedPlanIsValid | ( | CachedPlanSource * | plansource | ) |
Definition at line 1764 of file plancache.c.
References Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::is_valid, and CachedPlanSource::magic.
Referenced by SPI_plan_is_valid().
| void CachedPlanSetParentContext | ( | CachedPlanSource * | plansource, |
| MemoryContext | newcontext | ||
| ) |
Definition at line 1633 of file plancache.c.
References Assert, CACHEDPLAN_MAGIC, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::context, CachedPlan::context, elog, ERROR, fb(), CachedPlanSource::gplan, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_saved, CachedPlanSource::magic, CachedPlan::magic, and MemoryContextSetParent().
Referenced by _SPI_make_plan_non_temp().
|
static |
Definition at line 950 of file plancache.c.
References AcquireExecutorLocks(), Assert, CACHEDPLAN_MAGIC, GetUserId(), CachedPlanSource::gplan, CachedPlanSource::is_valid, plan, ReleaseGenericPlan(), TransactionIdEquals, TransactionIdIsValid, and TransactionXmin.
Referenced by GetCachedPlan().
|
static |
Definition at line 1173 of file plancache.c.
References CURSOR_OPT_CUSTOM_PLAN, CURSOR_OPT_GENERIC_PLAN, CachedPlanSource::cursor_options, fb(), CachedPlanSource::generic_cost, CachedPlanSource::is_oneshot, CachedPlanSource::num_custom_plans, plan_cache_mode, PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN, PLAN_CACHE_MODE_FORCE_GENERIC_PLAN, StmtPlanRequiresRevalidation(), and CachedPlanSource::total_custom_cost.
Referenced by GetCachedPlan().
| void CompleteCachedPlan | ( | CachedPlanSource * | plansource, |
| List * | querytree_list, | ||
| MemoryContext | querytree_context, | ||
| Oid * | param_types, | ||
| int | num_params, | ||
| ParserSetupHook | parserSetup, | ||
| void * | parserSetupArg, | ||
| int | cursor_options, | ||
| bool | fixed_result | ||
| ) |
Definition at line 391 of file plancache.c.
References ALLOCSET_START_SMALL_SIZES, AllocSetContextCreate, Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::context, copyObject, CreateTupleDescCopy(), CurrentMemoryContext, CachedPlanSource::cursor_options, CachedPlanSource::dependsOnRLS, extract_query_dependencies(), fb(), CachedPlanSource::fixed_result, GetSearchPathMatcher(), GetUserId(), CachedPlanSource::invalItems, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_valid, CachedPlanSource::magic, MemoryContextSetParent(), MemoryContextSwitchTo(), CachedPlanSource::num_params, palloc_array, CachedPlanSource::param_types, CachedPlanSource::parserSetup, CachedPlanSource::parserSetupArg, PlanCacheComputeResultDesc(), CachedPlanSource::query_context, CachedPlanSource::query_list, CachedPlanSource::relationOids, CachedPlanSource::resultDesc, CachedPlanSource::rewriteRoleId, CachedPlanSource::rewriteRowSecurity, row_security, CachedPlanSource::search_path, and StmtPlanRequiresRevalidation().
Referenced by _SPI_execute_plan(), _SPI_prepare_plan(), exec_parse_message(), prepare_next_query(), and PrepareQuery().
| CachedPlanSource * CopyCachedPlan | ( | CachedPlanSource * | plansource | ) |
Definition at line 1671 of file plancache.c.
References ALLOCSET_START_SMALL_SIZES, AllocSetContextCreate, CachedPlanSource::analyzed_parse_tree, Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::commandTag, copyObject, CopySearchPathMatcher(), CreateTupleDescCopy(), CurrentMemoryContext, CachedPlanSource::cursor_options, CachedPlanSource::dependsOnRLS, elog, ERROR, fb(), CachedPlanSource::fixed_result, CachedPlanSource::generation, CachedPlanSource::generic_cost, CachedPlanSource::invalItems, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_valid, CachedPlanSource::magic, MemoryContextSetIdentifier(), MemoryContextSwitchTo(), CachedPlanSource::num_custom_plans, CachedPlanSource::num_generic_plans, CachedPlanSource::num_params, palloc0_object, palloc_array, CachedPlanSource::param_types, CachedPlanSource::parserSetup, CachedPlanSource::parserSetupArg, CachedPlanSource::postRewrite, CachedPlanSource::postRewriteArg, pstrdup(), CachedPlanSource::query_list, CachedPlanSource::query_string, CachedPlanSource::raw_parse_tree, CachedPlanSource::relationOids, CachedPlanSource::resultDesc, CachedPlanSource::rewriteRoleId, CachedPlanSource::rewriteRowSecurity, CachedPlanSource::search_path, and CachedPlanSource::total_custom_cost.
Referenced by _SPI_save_plan().
| CachedPlanSource * CreateCachedPlan | ( | RawStmt * | raw_parse_tree, |
| const char * | query_string, | ||
| CommandTag | commandTag | ||
| ) |
Definition at line 183 of file plancache.c.
References ALLOCSET_START_SMALL_SIZES, AllocSetContextCreate, CachedPlanSource::analyzed_parse_tree, Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::commandTag, CachedPlanSource::context, copyObject, CurrentMemoryContext, CachedPlanSource::cursor_options, CachedPlanSource::dependsOnRLS, fb(), CachedPlanSource::fixed_result, CachedPlanSource::generation, CachedPlanSource::generic_cost, CachedPlanSource::gplan, InvalidOid, CachedPlanSource::invalItems, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_saved, CachedPlanSource::is_valid, CachedPlanSource::magic, MemoryContextSetIdentifier(), MemoryContextSwitchTo(), NIL, CachedPlanSource::num_custom_plans, CachedPlanSource::num_generic_plans, CachedPlanSource::num_params, palloc0_object, CachedPlanSource::param_types, CachedPlanSource::parserSetup, CachedPlanSource::parserSetupArg, CachedPlanSource::postRewrite, CachedPlanSource::postRewriteArg, pstrdup(), CachedPlanSource::query_context, CachedPlanSource::query_list, CachedPlanSource::query_string, CachedPlanSource::raw_parse_tree, CachedPlanSource::relationOids, CachedPlanSource::resultDesc, CachedPlanSource::rewriteRoleId, CachedPlanSource::rewriteRowSecurity, CachedPlanSource::search_path, and CachedPlanSource::total_custom_cost.
Referenced by _SPI_prepare_plan(), CreateCachedPlanForQuery(), exec_parse_message(), prepare_next_query(), and PrepareQuery().
| CachedPlanSource * CreateCachedPlanForQuery | ( | Query * | analyzed_parse_tree, |
| const char * | query_string, | ||
| CommandTag | commandTag | ||
| ) |
Definition at line 263 of file plancache.c.
References CachedPlanSource::analyzed_parse_tree, CachedPlanSource::context, copyObject, CreateCachedPlan(), fb(), and MemoryContextSwitchTo().
Referenced by prepare_next_query().
| CachedPlanSource * CreateOneShotCachedPlan | ( | RawStmt * | raw_parse_tree, |
| const char * | query_string, | ||
| CommandTag | commandTag | ||
| ) |
Definition at line 298 of file plancache.c.
References CachedPlanSource::analyzed_parse_tree, Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::commandTag, CachedPlanSource::context, CurrentMemoryContext, CachedPlanSource::cursor_options, CachedPlanSource::dependsOnRLS, fb(), CachedPlanSource::fixed_result, CachedPlanSource::generation, CachedPlanSource::generic_cost, CachedPlanSource::gplan, InvalidOid, CachedPlanSource::invalItems, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_saved, CachedPlanSource::is_valid, CachedPlanSource::magic, NIL, CachedPlanSource::num_custom_plans, CachedPlanSource::num_generic_plans, CachedPlanSource::num_params, palloc0_object, CachedPlanSource::param_types, CachedPlanSource::parserSetup, CachedPlanSource::parserSetupArg, CachedPlanSource::postRewrite, CachedPlanSource::postRewriteArg, CachedPlanSource::query_context, CachedPlanSource::query_list, CachedPlanSource::query_string, CachedPlanSource::raw_parse_tree, CachedPlanSource::relationOids, CachedPlanSource::resultDesc, CachedPlanSource::rewriteRoleId, CachedPlanSource::rewriteRowSecurity, CachedPlanSource::search_path, and CachedPlanSource::total_custom_cost.
Referenced by _SPI_prepare_oneshot_plan().
| void DropCachedPlan | ( | CachedPlanSource * | plansource | ) |
Definition at line 589 of file plancache.c.
References Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::context, dlist_delete(), CachedPlanSource::is_oneshot, CachedPlanSource::is_saved, CachedPlanSource::magic, MemoryContextDelete(), CachedPlanSource::node, and ReleaseGenericPlan().
Referenced by drop_unnamed_stmt(), DropAllPreparedStatements(), DropPreparedStatement(), SPI_freeplan(), and sql_delete_callback().
| void FreeCachedExpression | ( | CachedExpression * | cexpr | ) |
Definition at line 1871 of file plancache.c.
References Assert, CACHEDEXPR_MAGIC, CachedExpression::context, dlist_delete(), CachedExpression::magic, MemoryContextDelete(), and CachedExpression::node.
Referenced by get_cast_hashentry().
| CachedExpression * GetCachedExpression | ( | Node * | expr | ) |
Definition at line 1814 of file plancache.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, cached_expression_list, CACHEDEXPR_MAGIC, CacheMemoryContext, CachedExpression::context, copyObject, CurrentMemoryContext, dlist_push_tail(), CachedExpression::expr, expression_planner_with_deps(), fb(), CachedExpression::invalItems, CachedExpression::is_valid, CachedExpression::magic, MemoryContextSetParent(), MemoryContextSwitchTo(), CachedExpression::node, palloc_object, and CachedExpression::relationOids.
Referenced by get_cast_hashentry().
| CachedPlan * GetCachedPlan | ( | CachedPlanSource * | plansource, |
| ParamListInfo | boundParams, | ||
| ResourceOwner | owner, | ||
| QueryEnvironment * | queryEnv | ||
| ) |
Definition at line 1295 of file plancache.c.
References Assert, BuildCachedPlan(), cached_plan_cost(), CACHEDPLAN_MAGIC, CACHEDPLANSOURCE_MAGIC, CacheMemoryContext, CheckCachedPlan(), choose_custom_plan(), CachedPlanSource::context, elog, ERROR, fb(), CachedPlanSource::generic_cost, CachedPlanSource::gplan, CachedPlanSource::is_complete, CachedPlanSource::is_saved, lfirst, CachedPlanSource::magic, MemoryContextGetParent(), MemoryContextSetParent(), NIL, CachedPlanSource::num_custom_plans, CachedPlanSource::num_generic_plans, plan, PLAN_STMT_CACHE_CUSTOM, PLAN_STMT_CACHE_GENERIC, PlannedStmt::planOrigin, CachedPlan::refcount, ReleaseGenericPlan(), ResourceOwnerEnlarge(), ResourceOwnerRememberPlanCacheRef(), RevalidateCachedQuery(), and CachedPlanSource::total_custom_cost.
Referenced by _SPI_execute_plan(), exec_bind_message(), ExecuteQuery(), ExplainExecuteQuery(), init_execution_state(), SPI_cursor_open_internal(), and SPI_plan_get_cached_plan().
Definition at line 146 of file plancache.c.
References CacheRegisterRelcacheCallback(), CacheRegisterSyscacheCallback(), fb(), PlanCacheObjectCallback(), PlanCacheRelCallback(), and PlanCacheSysCallback().
Referenced by InitPostgres().
Definition at line 2084 of file plancache.c.
References Assert, ChoosePortalStrategy(), ExecCleanTypeFromTL(), fb(), linitial_node, PORTAL_MULTI_QUERY, PORTAL_ONE_MOD_WITH, PORTAL_ONE_RETURNING, PORTAL_ONE_SELECT, PORTAL_UTIL_SELECT, QueryListGetPrimaryStmt(), Query::returningList, Query::targetList, Query::utilityStmt, and UtilityTupleDescriptor().
Referenced by CompleteCachedPlan(), and RevalidateCachedQuery().
Definition at line 2204 of file plancache.c.
References Assert, cached_expression_list, CACHEDEXPR_MAGIC, CACHEDPLANSOURCE_MAGIC, PlanInvalItem::cacheId, CMD_UTILITY, PlannedStmt::commandType, dlist_iter::cur, dlist_container, dlist_foreach, fb(), CachedPlanSource::gplan, PlanInvalItem::hashValue, PlannedStmt::invalItems, CachedPlanSource::invalItems, CachedExpression::invalItems, CachedPlanSource::is_valid, CachedPlan::is_valid, CachedExpression::is_valid, lfirst, lfirst_node, CachedPlanSource::magic, CachedExpression::magic, saved_plan_list, CachedPlan::stmt_list, and StmtPlanRequiresRevalidation().
Referenced by InitPlanCache().
Definition at line 2120 of file plancache.c.
References Assert, cached_expression_list, CACHEDEXPR_MAGIC, CACHEDPLANSOURCE_MAGIC, CMD_UTILITY, PlannedStmt::commandType, dlist_iter::cur, dlist_container, dlist_foreach, fb(), CachedPlanSource::gplan, InvalidOid, CachedPlanSource::is_valid, CachedPlan::is_valid, CachedExpression::is_valid, lfirst_node, list_member_oid(), CachedPlanSource::magic, CachedExpression::magic, NIL, PlannedStmt::relationOids, CachedPlanSource::relationOids, CachedExpression::relationOids, saved_plan_list, CachedPlan::stmt_list, and StmtPlanRequiresRevalidation().
Referenced by InitPlanCache().
Definition at line 2313 of file plancache.c.
References ResetPlanCache().
Referenced by InitPlanCache().
Definition at line 1890 of file plancache.c.
References fb(), lfirst_node, and stmt.
Referenced by CachedPlanGetTargetList(), and PlanCacheComputeResultDesc().
| void ReleaseAllPlanCacheRefsInOwner | ( | ResourceOwner | owner | ) |
Definition at line 2369 of file plancache.c.
References planref_resowner_desc, and ResourceOwnerReleaseAllOfKind().
Referenced by plpgsql_call_handler(), plpgsql_inline_handler(), and plpgsql_xact_cb().
| void ReleaseCachedPlan | ( | CachedPlan * | plan, |
| ResourceOwner | owner | ||
| ) |
Definition at line 1426 of file plancache.c.
References Assert, CACHEDPLAN_MAGIC, MemoryContextDelete(), plan, and ResourceOwnerForgetPlanCacheRef().
Referenced by _SPI_execute_plan(), exec_eval_simple_expr(), exec_simple_check_plan(), ExplainExecuteQuery(), init_execution_state(), make_callstmt_target(), PortalReleaseCachedPlan(), ReleaseGenericPlan(), ResOwnerReleaseCachedPlan(), ShutdownSQLFunction(), and SPI_cursor_open_internal().
|
static |
Definition at line 618 of file plancache.c.
References Assert, CACHEDPLAN_MAGIC, fb(), CachedPlanSource::gplan, plan, and ReleaseCachedPlan().
Referenced by CheckCachedPlan(), DropCachedPlan(), GetCachedPlan(), RevalidateCachedQuery(), and SaveCachedPlan().
Definition at line 2322 of file plancache.c.
References Assert, cached_expression_list, CACHEDEXPR_MAGIC, CACHEDPLANSOURCE_MAGIC, dlist_iter::cur, dlist_container, dlist_foreach, CachedPlanSource::gplan, CachedPlanSource::is_valid, CachedPlan::is_valid, CachedExpression::is_valid, CachedPlanSource::magic, CachedExpression::magic, saved_plan_list, and StmtPlanRequiresRevalidation().
Referenced by assign_session_replication_role(), DiscardAll(), DiscardCommand(), and PlanCacheSysCallback().
|
inlinestatic |
Definition at line 131 of file plancache.c.
References plan, planref_resowner_desc, PointerGetDatum(), and ResourceOwnerForget().
Referenced by ReleaseCachedPlan().
|
inlinestatic |
Definition at line 126 of file plancache.c.
References plan, planref_resowner_desc, PointerGetDatum(), and ResourceOwnerRemember().
Referenced by CachedPlanAllowsSimpleValidityCheck(), CachedPlanIsSimplyValid(), and GetCachedPlan().
Definition at line 2377 of file plancache.c.
References DatumGetPointer(), fb(), and ReleaseCachedPlan().
|
static |
Definition at line 682 of file plancache.c.
References AcquirePlannerLocks(), AcquireRewriteLocks(), ActiveSnapshotSet(), ALLOCSET_START_SMALL_SIZES, AllocSetContextCreate, CachedPlanSource::analyzed_parse_tree, Assert, CachedPlanSource::context, copyObject, CreateTupleDescCopy(), CurrentMemoryContext, CachedPlanSource::dependsOnRLS, equalRowTypes(), ereport, errcode(), errmsg(), ERROR, extract_query_dependencies(), fb(), CachedPlanSource::fixed_result, FreeTupleDesc(), GetSearchPathMatcher(), GetTransactionSnapshot(), GetUserId(), CachedPlanSource::gplan, CachedPlanSource::invalItems, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_valid, CachedPlan::is_valid, MemoryContextDelete(), MemoryContextSetParent(), MemoryContextSwitchTo(), NIL, CachedPlanSource::num_params, CachedPlanSource::param_types, CachedPlanSource::parserSetup, CachedPlanSource::parserSetupArg, pg_analyze_and_rewrite_fixedparams(), pg_analyze_and_rewrite_withcb(), pg_rewrite_query(), PlanCacheComputeResultDesc(), PopActiveSnapshot(), CachedPlanSource::postRewrite, CachedPlanSource::postRewriteArg, PushActiveSnapshot(), CachedPlanSource::query_context, CachedPlanSource::query_list, CachedPlanSource::query_string, CachedPlanSource::raw_parse_tree, CachedPlanSource::relationOids, ReleaseGenericPlan(), CachedPlanSource::resultDesc, CachedPlanSource::rewriteRoleId, CachedPlanSource::rewriteRowSecurity, row_security, CachedPlanSource::search_path, SearchPathMatchesCurrentEnvironment(), and StmtPlanRequiresRevalidation().
Referenced by BuildCachedPlan(), CachedPlanGetTargetList(), and GetCachedPlan().
| void SaveCachedPlan | ( | CachedPlanSource * | plansource | ) |
Definition at line 545 of file plancache.c.
References Assert, CACHEDPLANSOURCE_MAGIC, CacheMemoryContext, CachedPlanSource::context, dlist_push_tail(), elog, ERROR, CachedPlanSource::is_complete, CachedPlanSource::is_oneshot, CachedPlanSource::is_saved, CachedPlanSource::magic, MemoryContextSetParent(), CachedPlanSource::node, ReleaseGenericPlan(), and saved_plan_list.
Referenced by _SPI_save_plan(), exec_parse_message(), prepare_next_query(), SPI_keepplan(), and StorePreparedStatement().
Definition at line 1990 of file plancache.c.
References Assert, castNode, CMD_UTILITY, Query::commandType, Query::cteList, CommonTableExpr::ctequery, fb(), lfirst, lfirst_node, LockRelationOid(), OidIsValid, QTW_IGNORE_RC_SUBQUERIES, query_tree_walker, Query::rtable, RTE_RELATION, RTE_SUBQUERY, ScanQueryForLocks(), ScanQueryWalker(), and UnlockRelationOid().
Referenced by AcquireExecutorLocks(), AcquirePlannerLocks(), ScanQueryForLocks(), and ScanQueryWalker().
Definition at line 2056 of file plancache.c.
References castNode, expression_tree_walker, fb(), IsA, ScanQueryForLocks(), ScanQueryWalker(), and SubLink::subselect.
Referenced by ScanQueryForLocks(), and ScanQueryWalker().
| void SetPostRewriteHook | ( | CachedPlanSource * | plansource, |
| PostRewriteHook | postRewrite, | ||
| void * | postRewriteArg | ||
| ) |
Definition at line 520 of file plancache.c.
References Assert, CACHEDPLANSOURCE_MAGIC, CachedPlanSource::magic, CachedPlanSource::postRewrite, and CachedPlanSource::postRewriteArg.
Referenced by prepare_next_query().
|
static |
Definition at line 640 of file plancache.c.
References CachedPlanSource::analyzed_parse_tree, fb(), query_requires_rewrite_plan(), CachedPlanSource::raw_parse_tree, and stmt_requires_parse_analysis().
Referenced by choose_custom_plan(), CompleteCachedPlan(), PlanCacheObjectCallback(), PlanCacheRelCallback(), ResetPlanCache(), and RevalidateCachedQuery().
|
static |
Definition at line 89 of file plancache.c.
Referenced by GetCachedExpression(), PlanCacheObjectCallback(), PlanCacheRelCallback(), and ResetPlanCache().
| int plan_cache_mode = PLAN_CACHE_MODE_AUTO |
Definition at line 138 of file plancache.c.
Referenced by choose_custom_plan().
|
static |
Definition at line 115 of file plancache.c.
Referenced by ReleaseAllPlanCacheRefsInOwner(), ResourceOwnerForgetPlanCacheRef(), and ResourceOwnerRememberPlanCacheRef().
|
static |
Definition at line 84 of file plancache.c.
Referenced by PlanCacheObjectCallback(), PlanCacheRelCallback(), ResetPlanCache(), and SaveCachedPlan().