PostgreSQL Source Code git master
|
#include "postgres.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "commands/createas.h"
#include "commands/defrem.h"
#include "commands/explain.h"
#include "commands/explain_dr.h"
#include "commands/explain_format.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
#include "foreign/fdwapi.h"
#include "jit/jit.h"
#include "libpq/pqformat.h"
#include "libpq/protocol.h"
#include "nodes/extensible.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "parser/analyze.h"
#include "parser/parsetree.h"
#include "rewrite/rewriteHandler.h"
#include "storage/bufmgr.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/guc_tables.h"
#include "utils/json.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/tuplesort.h"
#include "utils/typcache.h"
#include "utils/xml.h"
Go to the source code of this file.
Macros | |
#define | BYTES_TO_KILOBYTES(b) (((b) + 1023) / 1024) |
Functions | |
static void | ExplainOneQuery (Query *query, int cursorOptions, IntoClause *into, ExplainState *es, ParseState *pstate, ParamListInfo params) |
static void | ExplainPrintJIT (ExplainState *es, int jit_flags, JitInstrumentation *ji) |
static void | ExplainPrintSerialize (ExplainState *es, SerializeMetrics *metrics) |
static void | report_triggers (ResultRelInfo *rInfo, bool show_relname, ExplainState *es) |
static double | elapsed_time (instr_time *starttime) |
static bool | ExplainPreScanNode (PlanState *planstate, Bitmapset **rels_used) |
static void | ExplainNode (PlanState *planstate, List *ancestors, const char *relationship, const char *plan_name, ExplainState *es) |
static void | show_plan_tlist (PlanState *planstate, List *ancestors, ExplainState *es) |
static void | show_expression (Node *node, const char *qlabel, PlanState *planstate, List *ancestors, bool useprefix, ExplainState *es) |
static void | show_qual (List *qual, const char *qlabel, PlanState *planstate, List *ancestors, bool useprefix, ExplainState *es) |
static void | show_scan_qual (List *qual, const char *qlabel, PlanState *planstate, List *ancestors, ExplainState *es) |
static void | show_upper_qual (List *qual, const char *qlabel, PlanState *planstate, List *ancestors, ExplainState *es) |
static void | show_sort_keys (SortState *sortstate, List *ancestors, ExplainState *es) |
static void | show_incremental_sort_keys (IncrementalSortState *incrsortstate, List *ancestors, ExplainState *es) |
static void | show_merge_append_keys (MergeAppendState *mstate, List *ancestors, ExplainState *es) |
static void | show_agg_keys (AggState *astate, List *ancestors, ExplainState *es) |
static void | show_grouping_sets (PlanState *planstate, Agg *agg, List *ancestors, ExplainState *es) |
static void | show_grouping_set_keys (PlanState *planstate, Agg *aggnode, Sort *sortnode, List *context, bool useprefix, List *ancestors, ExplainState *es) |
static void | show_group_keys (GroupState *gstate, List *ancestors, ExplainState *es) |
static void | show_sort_group_keys (PlanState *planstate, const char *qlabel, int nkeys, int nPresortedKeys, AttrNumber *keycols, Oid *sortOperators, Oid *collations, bool *nullsFirst, List *ancestors, ExplainState *es) |
static void | show_sortorder_options (StringInfo buf, Node *sortexpr, Oid sortOperator, Oid collation, bool nullsFirst) |
static void | show_window_def (WindowAggState *planstate, List *ancestors, ExplainState *es) |
static void | show_window_keys (StringInfo buf, PlanState *planstate, int nkeys, AttrNumber *keycols, List *ancestors, ExplainState *es) |
static void | show_storage_info (char *maxStorageType, int64 maxSpaceUsed, ExplainState *es) |
static void | show_tablesample (TableSampleClause *tsc, PlanState *planstate, List *ancestors, ExplainState *es) |
static void | show_sort_info (SortState *sortstate, ExplainState *es) |
static void | show_incremental_sort_info (IncrementalSortState *incrsortstate, ExplainState *es) |
static void | show_hash_info (HashState *hashstate, ExplainState *es) |
static void | show_material_info (MaterialState *mstate, ExplainState *es) |
static void | show_windowagg_info (WindowAggState *winstate, ExplainState *es) |
static void | show_ctescan_info (CteScanState *ctescanstate, ExplainState *es) |
static void | show_table_func_scan_info (TableFuncScanState *tscanstate, ExplainState *es) |
static void | show_recursive_union_info (RecursiveUnionState *rstate, ExplainState *es) |
static void | show_memoize_info (MemoizeState *mstate, List *ancestors, ExplainState *es) |
static void | show_hashagg_info (AggState *aggstate, ExplainState *es) |
static void | show_indexsearches_info (PlanState *planstate, ExplainState *es) |
static void | show_tidbitmap_info (BitmapHeapScanState *planstate, ExplainState *es) |
static void | show_instrumentation_count (const char *qlabel, int which, PlanState *planstate, ExplainState *es) |
static void | show_foreignscan_info (ForeignScanState *fsstate, ExplainState *es) |
static const char * | explain_get_index_name (Oid indexId) |
static bool | peek_buffer_usage (ExplainState *es, const BufferUsage *usage) |
static void | show_buffer_usage (ExplainState *es, const BufferUsage *usage) |
static void | show_wal_usage (ExplainState *es, const WalUsage *usage) |
static void | show_memory_counters (ExplainState *es, const MemoryContextCounters *mem_counters) |
static void | ExplainIndexScanDetails (Oid indexid, ScanDirection indexorderdir, ExplainState *es) |
static void | ExplainScanTarget (Scan *plan, ExplainState *es) |
static void | ExplainModifyTarget (ModifyTable *plan, ExplainState *es) |
static void | ExplainTargetRel (Plan *plan, Index rti, ExplainState *es) |
static void | show_modifytable_info (ModifyTableState *mtstate, List *ancestors, ExplainState *es) |
static void | ExplainMemberNodes (PlanState **planstates, int nplans, List *ancestors, ExplainState *es) |
static void | ExplainMissingMembers (int nplans, int nchildren, ExplainState *es) |
static void | ExplainSubPlans (List *plans, List *ancestors, const char *relationship, ExplainState *es) |
static void | ExplainCustomChildren (CustomScanState *css, List *ancestors, ExplainState *es) |
static ExplainWorkersState * | ExplainCreateWorkersState (int num_workers) |
static void | ExplainOpenWorker (int n, ExplainState *es) |
static void | ExplainCloseWorker (int n, ExplainState *es) |
static void | ExplainFlushWorkersState (ExplainState *es) |
void | ExplainQuery (ParseState *pstate, ExplainStmt *stmt, ParamListInfo params, DestReceiver *dest) |
TupleDesc | ExplainResultDesc (ExplainStmt *stmt) |
void | standard_ExplainOneQuery (Query *query, int cursorOptions, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv) |
void | ExplainOneUtility (Node *utilityStmt, IntoClause *into, ExplainState *es, ParseState *pstate, ParamListInfo params) |
void | ExplainOnePlan (PlannedStmt *plannedstmt, CachedPlan *cplan, CachedPlanSource *plansource, int query_index, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv, const instr_time *planduration, const BufferUsage *bufusage, const MemoryContextCounters *mem_counters) |
static void | ExplainPrintSettings (ExplainState *es) |
void | ExplainPrintPlan (ExplainState *es, QueryDesc *queryDesc) |
void | ExplainPrintTriggers (ExplainState *es, QueryDesc *queryDesc) |
void | ExplainPrintJITSummary (ExplainState *es, QueryDesc *queryDesc) |
void | ExplainQueryText (ExplainState *es, QueryDesc *queryDesc) |
void | ExplainQueryParameters (ExplainState *es, ParamListInfo params, int maxlen) |
static bool | plan_is_disabled (Plan *plan) |
static void | show_incremental_sort_group_info (IncrementalSortGroupInfo *groupInfo, const char *groupLabel, bool indent, ExplainState *es) |
|
static |
Definition at line 1179 of file explain.c.
References INSTR_TIME_GET_DOUBLE, INSTR_TIME_SET_CURRENT, and INSTR_TIME_SUBTRACT.
Referenced by ExplainOnePlan(), and IsCheckpointOnSchedule().
|
static |
Definition at line 4034 of file explain.c.
References elog, ERROR, explain_get_index_name_hook, and get_rel_name().
Referenced by ExplainIndexScanDetails(), and ExplainNode().
|
static |
Definition at line 4930 of file explain.c.
References Assert(), StringInfoData::data, EXPLAIN_FORMAT_TEXT, ExplainSaveGroup(), ExplainState::format, ExplainState::indent, StringInfoData::len, ExplainWorkersState::prev_str, ExplainState::str, ExplainWorkersState::worker_inited, ExplainWorkersState::worker_state_save, and ExplainState::workers_state.
Referenced by ExplainNode(), show_hashagg_info(), show_incremental_sort_info(), show_memoize_info(), show_sort_info(), and show_tidbitmap_info().
|
static |
Definition at line 4851 of file explain.c.
References ExplainWorkersState::num_workers, palloc(), palloc0(), ExplainWorkersState::worker_inited, ExplainWorkersState::worker_state_save, and ExplainWorkersState::worker_str.
Referenced by ExplainNode().
|
static |
Definition at line 4829 of file explain.c.
References CustomScanState::custom_ps, ExplainNode(), label, lfirst, and list_length().
Referenced by ExplainNode().
|
static |
Definition at line 4966 of file explain.c.
References appendStringInfoString(), StringInfoData::data, ExplainCloseGroup(), ExplainOpenGroup(), i, ExplainWorkersState::num_workers, pfree(), ExplainState::str, ExplainWorkersState::worker_inited, ExplainWorkersState::worker_state_save, ExplainWorkersState::worker_str, and ExplainState::workers_state.
Referenced by ExplainNode().
|
static |
Definition at line 4336 of file explain.c.
References appendStringInfo(), appendStringInfoString(), BackwardScanDirection, EXPLAIN_FORMAT_TEXT, explain_get_index_name(), ExplainPropertyText(), ExplainState::format, ForwardScanDirection, quote_identifier(), ScanDirectionIsBackward, and ExplainState::str.
Referenced by ExplainNode().
|
static |
Definition at line 4754 of file explain.c.
References ExplainNode(), and j.
Referenced by ExplainNode().
|
static |
Definition at line 4772 of file explain.c.
References EXPLAIN_FORMAT_TEXT, ExplainPropertyInteger(), and format.
Referenced by ExplainNode().
|
static |
Definition at line 4385 of file explain.c.
References ExplainTargetRel(), and plan.
Referenced by ExplainNode().
|
static |
Definition at line 1363 of file explain.c.
References AGG_HASHED, AGG_MIXED, AGG_PLAIN, AGG_SORTED, Agg::aggsplit, Agg::aggstrategy, ExplainState::analyze, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), ExplainState::buffers, Instrumentation::bufusage, castNode, CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_SELECT, CMD_UPDATE, ExplainState::costs, DO_AGGSPLIT_COMBINE, DO_AGGSPLIT_SKIPFINAL, EState::es_jit_flags, EXPLAIN_FORMAT_TEXT, explain_get_index_name(), explain_per_node_hook, ExplainCloseGroup(), ExplainCloseWorker(), ExplainCreateWorkersState(), ExplainCustomChildren(), CustomExecMethods::ExplainCustomScan, ExplainFlushWorkersState(), ExplainIndentText(), ExplainIndexScanDetails(), ExplainMemberNodes(), ExplainMissingMembers(), ExplainModifyTarget(), ExplainNode(), ExplainOpenGroup(), ExplainOpenWorker(), ExplainPrintJIT(), ExplainPropertyBool(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainPropertyText(), ExplainScanTarget(), ExplainSubPlans(), ExplainState::format, RangeTblFunction::funcexpr, functions, ExplainState::hide_workers, if(), ExplainState::indent, IndexScan::indexid, IndexOnlyScan::indexid, BitmapIndexScan::indexid, IndexScan::indexorderdir, IndexOnlyScan::indexorderdir, PlanState::initPlan, innerPlanState, InstrEndLoop(), WorkerInstrumentation::instrument, PlanState::instrument, IsA, SharedJitInstrumentation::jit_instr, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, JOIN_RIGHT_ANTI, JOIN_RIGHT_SEMI, JOIN_SEMI, lappend(), lcons(), lfirst, list_delete_first(), list_length(), list_make1, make_andclause(), make_orclause(), CustomScanState::methods, NIL, Instrumentation::nloops, nodeTag, Instrumentation::ntuples, Instrumentation::ntuples2, WorkerInstrumentation::num_workers, SharedJitInstrumentation::num_workers, Gather::num_workers, GatherMerge::num_workers, outerPlanState, PlanState::plan, plan, plan_is_disabled(), psprintf(), quote_identifier(), SETOP_HASHED, SETOP_SORTED, SETOPCMD_EXCEPT, SETOPCMD_EXCEPT_ALL, SETOPCMD_INTERSECT, SETOPCMD_INTERSECT_ALL, show_agg_keys(), show_buffer_usage(), show_ctescan_info(), show_expression(), show_foreignscan_info(), show_group_keys(), show_hash_info(), show_hashagg_info(), show_incremental_sort_info(), show_incremental_sort_keys(), show_indexsearches_info(), show_instrumentation_count(), show_material_info(), show_memoize_info(), show_merge_append_keys(), show_modifytable_info(), show_plan_tlist(), show_recursive_union_info(), show_scan_qual(), show_sort_info(), show_sort_keys(), show_table_func_scan_info(), show_tablesample(), show_tidbitmap_info(), show_upper_qual(), show_wal_usage(), show_window_def(), show_windowagg_info(), Gather::single_copy, Instrumentation::startup, PlanState::state, ExplainState::str, PlanState::subPlan, ExplainState::timing, Instrumentation::total, ExplainState::verbose, ExplainState::wal, Instrumentation::walusage, PlanState::worker_instrument, PlanState::worker_jit_instrument, and ExplainState::workers_state.
Referenced by ExplainCustomChildren(), ExplainMemberNodes(), ExplainNode(), ExplainPrintPlan(), and ExplainSubPlans().
void ExplainOnePlan | ( | PlannedStmt * | plannedstmt, |
CachedPlan * | cplan, | ||
CachedPlanSource * | plansource, | ||
int | query_index, | ||
IntoClause * | into, | ||
ExplainState * | es, | ||
const char * | queryString, | ||
ParamListInfo | params, | ||
QueryEnvironment * | queryEnv, | ||
const instr_time * | planduration, | ||
const BufferUsage * | bufusage, | ||
const MemoryContextCounters * | mem_counters | ||
) |
Definition at line 495 of file explain.c.
References ExplainState::analyze, appendStringInfoString(), Assert(), ExplainState::buffers, CMD_UTILITY, CommandCounterIncrement(), PlannedStmt::commandType, ExplainState::costs, QueryDesc::cplan, CreateExplainSerializeDestReceiver(), CreateIntoRelDestReceiver(), CreateQueryDesc(), generate_unaccent_rules::dest, elapsed_time(), elog, ERROR, EXEC_FLAG_EXPLAIN_GENERIC, EXEC_FLAG_EXPLAIN_ONLY, ExecutorEnd(), ExecutorFinish(), ExecutorRun(), ExecutorStart(), ExecutorStartCachedPlan(), EXPLAIN_FORMAT_TEXT, explain_per_plan_hook, EXPLAIN_SERIALIZE_NONE, ExplainCloseGroup(), ExplainIndentText(), ExplainOpenGroup(), ExplainPrintJITSummary(), ExplainPrintPlan(), ExplainPrintSerialize(), ExplainPrintTriggers(), ExplainPropertyFloat(), ExplainState::format, ForwardScanDirection, FreeQueryDesc(), ExplainState::generic, GetActiveSnapshot(), GetIntoRelEFlags(), GetSerializationMetrics(), ExplainState::indent, INSTR_TIME_GET_DOUBLE, INSTR_TIME_SET_CURRENT, INSTRUMENT_BUFFERS, INSTRUMENT_ROWS, INSTRUMENT_TIMER, INSTRUMENT_WAL, InvalidSnapshot, NoMovementScanDirection, None_Receiver, peek_buffer_usage(), QueryDesc::planstate, PopActiveSnapshot(), PushCopiedSnapshot(), ExplainState::serialize, show_buffer_usage(), show_memory_counters(), IntoClause::skipData, ExplainState::str, ExplainState::summary, ExplainState::timing, UpdateActiveSnapshotCommandId(), and ExplainState::wal.
Referenced by ExplainExecuteQuery(), and standard_ExplainOneQuery().
|
static |
Definition at line 293 of file explain.c.
References CMD_UTILITY, Query::commandType, ExplainOneQuery_hook, ExplainOneUtility(), ParseState::p_queryEnv, ParseState::p_sourcetext, standard_ExplainOneQuery(), and Query::utilityStmt.
Referenced by ExplainOneUtility(), and ExplainQuery().
void ExplainOneUtility | ( | Node * | utilityStmt, |
IntoClause * | into, | ||
ExplainState * | es, | ||
ParseState * | pstate, | ||
ParamListInfo | params | ||
) |
Definition at line 391 of file explain.c.
References appendStringInfoString(), Assert(), castNode, copyObject, CreateTableAsRelExists(), CURSOR_OPT_PARALLEL_OK, elog, ERROR, EXPLAIN_FORMAT_TEXT, ExplainDummyGroup(), ExplainExecuteQuery(), ExplainOneQuery(), ExplainState::format, CreateTableAsStmt::into, IsA, IsQueryIdEnabled(), JumbleQuery(), linitial_node, list_length(), OBJECT_MATVIEW, OBJECT_TABLE, CreateTableAsStmt::objtype, DeclareCursorStmt::options, post_parse_analyze_hook, DeclareCursorStmt::query, CreateTableAsStmt::query, QueryRewrite(), and ExplainState::str.
Referenced by ExplainExecuteQuery(), and ExplainOneQuery().
|
static |
Definition at line 4868 of file explain.c.
References appendStringInfo(), Assert(), EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainOpenSetAsideGroup(), ExplainPropertyInteger(), ExplainRestoreGroup(), ExplainState::format, ExplainState::indent, initStringInfo(), StringInfoData::len, ExplainWorkersState::prev_str, ExplainState::str, ExplainWorkersState::worker_inited, ExplainWorkersState::worker_state_save, ExplainWorkersState::worker_str, and ExplainState::workers_state.
Referenced by ExplainNode(), show_hashagg_info(), show_incremental_sort_info(), show_memoize_info(), show_sort_info(), and show_tidbitmap_info().
Definition at line 1198 of file explain.c.
References bms_add_member(), bms_add_members(), ExplainPreScanNode(), nodeTag, PlanState::plan, plan, and planstate_tree_walker.
Referenced by ExplainPreScanNode(), and ExplainPrintPlan().
|
static |
Definition at line 917 of file explain.c.
References ExplainState::analyze, appendStringInfo(), appendStringInfoString(), JitInstrumentation::created_functions, JitInstrumentation::deform_counter, JitInstrumentation::emission_counter, EXPLAIN_FORMAT_TEXT, ExplainCloseGroup(), ExplainIndentText(), ExplainOpenGroup(), ExplainPropertyBool(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainState::format, JitInstrumentation::generation_counter, ExplainState::indent, JitInstrumentation::inlining_counter, INSTR_TIME_ADD, INSTR_TIME_GET_DOUBLE, INSTR_TIME_SET_ZERO, JitInstrumentation::optimization_counter, PGJIT_DEFORM, PGJIT_EXPR, PGJIT_INLINE, PGJIT_OPT3, ExplainState::str, and ExplainState::timing.
Referenced by ExplainNode(), and ExplainPrintJITSummary().
void ExplainPrintJITSummary | ( | ExplainState * | es, |
QueryDesc * | queryDesc | ||
) |
Definition at line 891 of file explain.c.
References EState::es_jit, EState::es_jit_flags, EState::es_jit_worker_instr, QueryDesc::estate, ExplainPrintJIT(), JitContext::instr, InstrJitAgg(), and PGJIT_PERFORM.
Referenced by explain_ExecutorEnd(), and ExplainOnePlan().
void ExplainPrintPlan | ( | ExplainState * | es, |
QueryDesc * | queryDesc | ||
) |
Definition at line 771 of file explain.c.
References Assert(), compute_query_id, COMPUTE_QUERY_ID_REGRESS, deparse_context_for_plan_tree(), ExplainState::deparse_cxt, ExplainNode(), ExplainPreScanNode(), ExplainPrintSettings(), ExplainPropertyInteger(), ExplainState::hide_workers, IsA, lfirst_node, list_length(), NIL, outerPlanState, QueryDesc::plannedstmt, QueryDesc::planstate, ExplainState::printed_subplans, ps, ExplainState::pstmt, PlannedStmt::queryId, ExplainState::rtable, PlannedStmt::rtable, ExplainState::rtable_names, ExplainState::rtable_size, RTE_GROUP, RangeTblEntry::rtekind, select_rtable_names_for_explain(), UINT64CONST, and ExplainState::verbose.
Referenced by explain_ExecutorEnd(), and ExplainOnePlan().
|
static |
Definition at line 1015 of file explain.c.
References appendStringInfo(), Assert(), ExplainState::buffers, SerializeMetrics::bufferUsage, BYTES_TO_KILOBYTES, SerializeMetrics::bytesSent, EXPLAIN_FORMAT_TEXT, EXPLAIN_SERIALIZE_BINARY, EXPLAIN_SERIALIZE_TEXT, ExplainCloseGroup(), ExplainIndentText(), ExplainOpenGroup(), ExplainPropertyFloat(), ExplainPropertyText(), ExplainPropertyUInteger(), format, ExplainState::format, ExplainState::indent, INSTR_TIME_GET_DOUBLE, peek_buffer_usage(), ExplainState::serialize, show_buffer_usage(), ExplainState::str, SerializeMetrics::timeSpent, ExplainState::timing, and UINT64_FORMAT.
Referenced by ExplainOnePlan().
|
static |
Definition at line 701 of file explain.c.
References appendStringInfo(), appendStringInfoString(), EXPLAIN_FORMAT_TEXT, ExplainCloseGroup(), ExplainOpenGroup(), ExplainPropertyText(), ExplainState::format, get_explain_guc_options(), GetConfigOptionByName(), i, initStringInfo(), config_generic::name, ExplainState::settings, and str.
Referenced by ExplainPrintPlan().
void ExplainPrintTriggers | ( | ExplainState * | es, |
QueryDesc * | queryDesc | ||
) |
Definition at line 848 of file explain.c.
References EState::es_opened_result_relations, EState::es_trig_target_relations, EState::es_tuple_routing_result_relations, QueryDesc::estate, ExplainCloseGroup(), ExplainOpenGroup(), lfirst, list_length(), NIL, and report_triggers().
Referenced by explain_ExecutorEnd(), and ExplainOnePlan().
void ExplainQuery | ( | ParseState * | pstate, |
ExplainStmt * | stmt, | ||
ParamListInfo | params, | ||
DestReceiver * | dest | ||
) |
Definition at line 176 of file explain.c.
References appendStringInfoString(), Assert(), begin_tup_output_tupdesc(), castNode, CURSOR_OPT_PARALLEL_OK, StringInfoData::data, generate_unaccent_rules::dest, do_text_output_multiline(), do_text_output_oneline, end_tup_output(), EXPLAIN_FORMAT_TEXT, ExplainBeginOutput(), ExplainEndOutput(), ExplainOneQuery(), ExplainResultDesc(), ExplainSeparatePlans(), ExplainState::format, ExplainState::indent, IsQueryIdEnabled(), JumbleQuery(), lfirst_node, lnext(), NewExplainState(), NIL, ParseExplainOptionList(), pfree(), post_parse_analyze_hook, QueryRewrite(), stmt, ExplainState::str, and TTSOpsVirtual.
Referenced by standard_ProcessUtility().
void ExplainQueryParameters | ( | ExplainState * | es, |
ParamListInfo | params, | ||
int | maxlen | ||
) |
Definition at line 1090 of file explain.c.
References BuildParamLogString(), ExplainPropertyText(), ParamListInfoData::numParams, and str.
Referenced by explain_ExecutorEnd().
void ExplainQueryText | ( | ExplainState * | es, |
QueryDesc * | queryDesc | ||
) |
Definition at line 1075 of file explain.c.
References ExplainPropertyText(), and QueryDesc::sourceText.
Referenced by explain_ExecutorEnd().
TupleDesc ExplainResultDesc | ( | ExplainStmt * | stmt | ) |
Definition at line 254 of file explain.c.
References CreateTemplateTupleDesc(), defGetString(), DefElem::defname, lfirst, stmt, and TupleDescInitEntry().
Referenced by ExplainQuery(), and UtilityTupleDescriptor().
|
static |
Definition at line 4372 of file explain.c.
References ExplainTargetRel(), and plan.
Referenced by ExplainNode().
|
static |
Definition at line 4786 of file explain.c.
References bms_add_member(), bms_is_member(), ExplainNode(), lcons(), lfirst, list_delete_first(), SubPlan::plan_id, SubPlan::plan_name, SubPlanState::planstate, ExplainState::printed_subplans, and SubPlanState::subplan.
Referenced by ExplainNode().
|
static |
Definition at line 4394 of file explain.c.
References appendStringInfo(), appendStringInfoString(), Assert(), elog, ERROR, EXPLAIN_FORMAT_TEXT, ExplainPropertyText(), ExplainState::format, RangeTblFunction::funcexpr, FuncExpr::funcid, FunctionScan::functions, TableFunc::functype, get_func_name(), get_func_namespace(), get_namespace_name_or_temp(), get_rel_name(), get_rel_namespace(), IsA, linitial, list_length(), list_nth(), nodeTag, plan, quote_identifier(), RangeTblEntry::relid, rt_fetch, ExplainState::rtable, ExplainState::rtable_names, RTE_CTE, RTE_FUNCTION, RTE_NAMEDTUPLESTORE, RTE_RELATION, RTE_TABLEFUNC, RTE_VALUES, RangeTblEntry::rtekind, ExplainState::str, TFT_JSON_TABLE, TFT_XMLTABLE, and ExplainState::verbose.
Referenced by ExplainModifyTarget(), ExplainScanTarget(), and show_modifytable_info().
|
static |
Definition at line 4058 of file explain.c.
References EXPLAIN_FORMAT_TEXT, ExplainState::format, INSTR_TIME_IS_ZERO, and usage().
Referenced by ExplainOnePlan(), and ExplainPrintSerialize().
|
static |
Definition at line 1258 of file explain.c.
References Append::appendplans, CustomScan::custom_plans, Plan::disabled_nodes, innerPlan, IsA, lfirst, MergeAppend::mergeplans, outerPlan, and plan.
Referenced by ExplainNode().
|
static |
Definition at line 1108 of file explain.c.
References appendStringInfo(), appendStringInfoString(), EXPLAIN_FORMAT_TEXT, ExplainCloseGroup(), ExplainOpenGroup(), ExplainPropertyFloat(), ExplainPropertyText(), ExplainState::format, get_constraint_name(), InstrEndLoop(), Instrumentation::ntuples, TriggerDesc::numtriggers, OidIsValid, pfree(), RelationGetRelationName, relname, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigInstrument, ExplainState::str, Trigger::tgconstraint, Trigger::tgname, ExplainState::timing, Instrumentation::total, TriggerDesc::triggers, and ExplainState::verbose.
Referenced by ExplainPrintTriggers().
|
static |
Definition at line 2628 of file explain.c.
References if(), lcons(), list_delete_first(), outerPlanState, PlanState::plan, plan, ScanState::ps, show_grouping_sets(), show_sort_group_keys(), and AggState::ss.
Referenced by ExplainNode().
|
static |
Definition at line 4098 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainState::format, INSTR_TIME_GET_MILLISEC, INSTR_TIME_IS_ZERO, ExplainState::str, track_io_timing, and usage().
Referenced by ExplainNode(), ExplainOnePlan(), and ExplainPrintSerialize().
|
static |
Definition at line 3525 of file explain.c.
References ExplainState::analyze, CteScanState::cte_table, CteScanState::leader, show_storage_info(), and tuplestore_get_stats().
Referenced by ExplainNode().
|
static |
Definition at line 2508 of file explain.c.
References config_generic::context, ExplainState::deparse_cxt, deparse_expression(), ExplainPropertyText(), PlanState::plan, and set_deparse_context_plan().
Referenced by ExplainNode(), and show_qual().
|
static |
Definition at line 4006 of file explain.c.
References CMD_SELECT, FdwRoutine::ExplainDirectModify, FdwRoutine::ExplainForeignScan, ForeignScanState::fdwroutine, PlanState::plan, ScanState::ps, and ForeignScanState::ss.
Referenced by ExplainNode().
|
static |
Definition at line 2760 of file explain.c.
References lcons(), list_delete_first(), outerPlanState, PlanState::plan, plan, ScanState::ps, show_sort_group_keys(), and GroupState::ss.
Referenced by ExplainNode().
|
static |
Definition at line 2682 of file explain.c.
References AGG_HASHED, AGG_MIXED, Agg::aggstrategy, config_generic::context, deparse_expression(), elog, ERROR, EXPLAIN_FORMAT_TEXT, ExplainCloseGroup(), ExplainOpenGroup(), ExplainPropertyListNested(), ExplainPropertyText(), TargetEntry::expr, ExplainState::format, get_tle_by_resno(), Agg::groupingSets, i, ExplainState::indent, lappend(), lfirst, lfirst_int, NIL, Sort::numCols, PlanState::plan, plan, and show_sort_group_keys().
Referenced by show_grouping_sets().
|
static |
Definition at line 2651 of file explain.c.
References Agg::chain, config_generic::context, ExplainState::deparse_cxt, ExplainCloseGroup(), ExplainOpenGroup(), Plan::lefttree, lfirst, PlanState::plan, Agg::plan, ExplainState::rtable_size, set_deparse_context_plan(), show_grouping_set_keys(), and ExplainState::verbose.
Referenced by show_agg_keys().
|
static |
Definition at line 3387 of file explain.c.
References appendStringInfo(), BYTES_TO_KILOBYTES, EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainPropertyInteger(), ExplainPropertyUInteger(), ExplainState::format, SharedHashInfo::hinstrument, HashState::hinstrument, i, Max, HashInstrumentation::nbatch, HashInstrumentation::nbatch_original, HashInstrumentation::nbuckets, HashInstrumentation::nbuckets_original, SharedHashInfo::num_workers, HashState::shared_info, HashInstrumentation::space_peak, ExplainState::str, and UINT64_FORMAT.
Referenced by ExplainNode().
|
static |
Definition at line 3728 of file explain.c.
References AGG_HASHED, AGG_MIXED, Agg::aggstrategy, ExplainState::analyze, appendStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), BYTES_TO_KILOBYTES, ExplainState::costs, EXPLAIN_FORMAT_TEXT, ExplainCloseWorker(), ExplainIndentText(), ExplainOpenWorker(), ExplainPropertyInteger(), ExplainState::format, AggregateInstrumentation::hash_batches_used, AggState::hash_batches_used, AggregateInstrumentation::hash_disk_used, AggState::hash_disk_used, AggregateInstrumentation::hash_mem_peak, AggState::hash_mem_peak, AggState::hash_planned_partitions, INT64_FORMAT, SharedAggInfo::num_workers, PlanState::plan, ScanState::ps, AggState::shared_info, SharedAggInfo::sinstrument, AggState::ss, ExplainState::str, UINT64_FORMAT, and ExplainState::workers_state.
Referenced by ExplainNode().
|
static |
Definition at line 3187 of file explain.c.
References appendStringInfo(), appendStringInfoSpaces(), appendStringInfoString(), bit(), StringInfoData::data, EXPLAIN_FORMAT_TEXT, ExplainCloseGroup(), ExplainOpenGroup(), ExplainPropertyInteger(), ExplainPropertyList(), foreach_current_index, ExplainState::format, IncrementalSortGroupInfo::groupCount, ExplainState::indent, initStringInfo(), INT64_FORMAT, lappend(), list_length(), IncrementalSortGroupInfo::maxDiskSpaceUsed, IncrementalSortGroupInfo::maxMemorySpaceUsed, NIL, NUM_TUPLESORTMETHODS, ListCell::ptr_value, SORT_SPACE_TYPE_DISK, SORT_SPACE_TYPE_MEMORY, IncrementalSortGroupInfo::sortMethods, ExplainState::str, IncrementalSortGroupInfo::totalDiskSpaceUsed, IncrementalSortGroupInfo::totalMemorySpaceUsed, tuplesort_method_name(), tuplesort_space_type_name(), and unconstify.
Referenced by show_incremental_sort_info().
|
static |
Definition at line 3301 of file explain.c.
References ExplainState::analyze, appendStringInfoChar(), EXPLAIN_FORMAT_TEXT, ExplainCloseWorker(), ExplainOpenWorker(), ExplainState::format, IncrementalSortInfo::fullsortGroupInfo, IncrementalSortGroupInfo::groupCount, IncrementalSortState::incsort_info, SharedIncrementalSortInfo::num_workers, IncrementalSortInfo::prefixsortGroupInfo, IncrementalSortState::shared_info, show_incremental_sort_group_info(), SharedIncrementalSortInfo::sinfo, ExplainState::str, ExplainState::verbose, and ExplainState::workers_state.
Referenced by ExplainNode().
|
static |
Definition at line 2595 of file explain.c.
References PlanState::plan, plan, ScanState::ps, show_sort_group_keys(), and IncrementalSortState::ss.
Referenced by ExplainNode().
|
static |
Definition at line 3850 of file explain.c.
References ExplainState::analyze, BitmapIndexScanState::biss_Instrument, BitmapIndexScanState::biss_SharedInfo, ExplainPropertyUInteger(), i, IndexOnlyScanState::ioss_Instrument, IndexOnlyScanState::ioss_SharedInfo, IndexScanState::iss_Instrument, IndexScanState::iss_SharedInfo, nodeTag, IndexScanInstrumentation::nsearches, SharedIndexScanInstrumentation::num_workers, PlanState::plan, plan, and SharedIndexScanInstrumentation::winstrument.
Referenced by ExplainNode().
|
static |
Definition at line 3977 of file explain.c.
References ExplainState::analyze, EXPLAIN_FORMAT_TEXT, ExplainPropertyFloat(), ExplainState::format, PlanState::instrument, Instrumentation::nfiltered1, Instrumentation::nfiltered2, and Instrumentation::nloops.
Referenced by ExplainNode(), and show_modifytable_info().
|
static |
Definition at line 3479 of file explain.c.
References ExplainState::analyze, show_storage_info(), tuplestore_get_stats(), and MaterialState::tuplestorestate.
Referenced by ExplainNode().
|
static |
Definition at line 3594 of file explain.c.
References ExplainState::analyze, appendStringInfo(), appendStringInfoString(), MemoizeState::binary_mode, BYTES_TO_KILOBYTES, MemoizeInstrumentation::cache_evictions, MemoizeInstrumentation::cache_hits, MemoizeInstrumentation::cache_misses, MemoizeInstrumentation::cache_overflows, config_generic::context, StringInfoData::data, ExplainState::deparse_cxt, deparse_expression(), EXPLAIN_FORMAT_TEXT, ExplainCloseWorker(), ExplainIndentText(), ExplainOpenWorker(), ExplainPropertyInteger(), ExplainPropertyText(), ExplainState::format, initStringInfo(), INT64_FORMAT, lfirst, MemoizeInstrumentation::mem_peak, MemoizeState::mem_used, SharedMemoizeInfo::num_workers, pfree(), plan, ExplainState::rtable_size, set_deparse_context_plan(), MemoizeState::shared_info, SharedMemoizeInfo::sinstrument, MemoizeState::stats, ExplainState::str, UINT64_FORMAT, ExplainState::verbose, and ExplainState::workers_state.
Referenced by ExplainNode().
|
static |
Definition at line 4310 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), BYTES_TO_KILOBYTES, EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainPropertyInteger(), ExplainState::format, MemoryContextCounters::freespace, INT64_FORMAT, ExplainState::str, and MemoryContextCounters::totalspace.
Referenced by ExplainOnePlan().
|
static |
Definition at line 2612 of file explain.c.
References PlanState::plan, plan, MergeAppendState::ps, and show_sort_group_keys().
Referenced by ExplainNode().
|
static |
Definition at line 4532 of file explain.c.
References ExplainState::analyze, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), ModifyTable::arbiterIndexes, Assert(), bms_is_member(), CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_UPDATE, EState::es_unpruned_relids, EXPLAIN_FORMAT_TEXT, ExplainCloseGroup(), FdwRoutine::ExplainForeignModify, ExplainIndentText(), ExplainOpenGroup(), ExplainPropertyFloat(), ExplainPropertyList(), ExplainPropertyText(), ExplainTargetRel(), ModifyTable::fdwPrivLists, ExplainState::format, get_rel_name(), ExplainState::indent, InstrEndLoop(), PlanState::instrument, j, lappend(), lfirst_oid, list_nth(), ModifyTableState::mt_merge_deleted, ModifyTableState::mt_merge_inserted, ModifyTableState::mt_merge_updated, ModifyTableState::mt_nrels, NIL, ModifyTable::nominalRelation, Instrumentation::ntuples2, ONCONFLICT_NONE, ONCONFLICT_NOTHING, ModifyTable::onConflictAction, ModifyTable::onConflictWhere, ModifyTable::operation, outerPlanState, PlanState::plan, ModifyTableState::ps, ModifyTableState::resultRelInfo, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_RangeTableIndex, ResultRelInfo::ri_usesFdwDirectModify, show_instrumentation_count(), show_upper_qual(), PlanState::state, and ExplainState::str.
Referenced by ExplainNode().
|
static |
Definition at line 2450 of file explain.c.
References CMD_SELECT, config_generic::context, ExplainState::deparse_cxt, deparse_expression(), ExplainPropertyList(), TargetEntry::expr, IsA, lappend(), lfirst, NIL, PlanState::plan, plan, ExplainState::rtable_size, and set_deparse_context_plan().
Referenced by ExplainNode().
|
static |
Definition at line 2531 of file explain.c.
References make_ands_explicit(), NIL, and show_expression().
Referenced by show_scan_qual(), and show_upper_qual().
|
static |
Definition at line 3563 of file explain.c.
References ExplainState::analyze, RecursiveUnionState::intermediate_table, show_storage_info(), tuplestore_get_stats(), and RecursiveUnionState::working_table.
Referenced by ExplainNode().
|
static |
Definition at line 2552 of file explain.c.
References IsA, PlanState::plan, show_qual(), and ExplainState::verbose.
Referenced by ExplainNode().
|
static |
Definition at line 2780 of file explain.c.
References appendStringInfoString(), config_generic::context, StringInfoData::data, ExplainState::deparse_cxt, deparse_expression(), elog, ERROR, ExplainPropertyList(), TargetEntry::expr, get_tle_by_resno(), initStringInfo(), lappend(), NIL, PlanState::plan, plan, pstrdup(), resetStringInfo(), ExplainState::rtable_size, set_deparse_context_plan(), show_sortorder_options(), and ExplainState::verbose.
Referenced by show_agg_keys(), show_group_keys(), show_grouping_set_keys(), show_incremental_sort_keys(), show_merge_append_keys(), and show_sort_keys().
|
static |
Definition at line 3096 of file explain.c.
References ExplainState::analyze, appendStringInfo(), EXPLAIN_FORMAT_TEXT, ExplainCloseWorker(), ExplainIndentText(), ExplainOpenWorker(), ExplainPropertyInteger(), ExplainPropertyText(), ExplainState::format, INT64_FORMAT, SharedSortInfo::num_workers, SortState::shared_info, SharedSortInfo::sinstrument, SortState::sort_Done, SORT_TYPE_STILL_IN_PROGRESS, TuplesortInstrumentation::sortMethod, TuplesortInstrumentation::spaceType, TuplesortInstrumentation::spaceUsed, ExplainState::str, tuplesort_get_stats(), tuplesort_method_name(), tuplesort_space_type_name(), SortState::tuplesortstate, and ExplainState::workers_state.
Referenced by ExplainNode().
|
static |
Definition at line 2580 of file explain.c.
References PlanState::plan, plan, ScanState::ps, show_sort_group_keys(), and SortState::ss.
Referenced by ExplainNode().
|
static |
Definition at line 2842 of file explain.c.
References appendStringInfo(), appendStringInfoString(), buf, elog, ERROR, exprType(), get_collation_name(), get_equality_op_for_ordering_op(), get_opname(), get_typcollation(), TypeCacheEntry::gt_opr, lookup_type_cache(), TypeCacheEntry::lt_opr, OidIsValid, quote_identifier(), TYPECACHE_GT_OPR, and TYPECACHE_LT_OPR.
Referenced by show_sort_group_keys().
|
static |
Definition at line 3007 of file explain.c.
References appendStringInfo(), BYTES_TO_KILOBYTES, EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainPropertyInteger(), ExplainPropertyText(), ExplainState::format, INT64_FORMAT, and ExplainState::str.
Referenced by show_ctescan_info(), show_material_info(), show_recursive_union_info(), show_table_func_scan_info(), and show_windowagg_info().
|
static |
Definition at line 3544 of file explain.c.
References ExplainState::analyze, show_storage_info(), tuplestore_get_stats(), and TableFuncScanState::tupstore.
Referenced by ExplainNode().
|
static |
Definition at line 3030 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), arg, TableSampleClause::args, config_generic::context, ExplainState::deparse_cxt, deparse_expression(), EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainPropertyList(), ExplainPropertyText(), ExplainState::format, get_func_name(), lappend(), lfirst, NIL, PlanState::plan, TableSampleClause::repeatable, ExplainState::rtable_size, set_deparse_context_plan(), ExplainState::str, and TableSampleClause::tsmhandler.
Referenced by ExplainNode().
|
static |
Definition at line 3908 of file explain.c.
References ExplainState::analyze, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), BitmapHeapScanInstrumentation::exact_pages, EXPLAIN_FORMAT_TEXT, ExplainCloseWorker(), ExplainIndentText(), ExplainOpenWorker(), ExplainPropertyUInteger(), ExplainState::format, BitmapHeapScanInstrumentation::lossy_pages, SharedBitmapHeapInstrumentation::num_workers, BitmapHeapScanState::pstate, SharedBitmapHeapInstrumentation::sinstrument, BitmapHeapScanState::sinstrument, BitmapHeapScanState::stats, ExplainState::str, UINT64_FORMAT, and ExplainState::workers_state.
Referenced by ExplainNode().
|
static |
Definition at line 2566 of file explain.c.
References ExplainState::rtable_size, show_qual(), and ExplainState::verbose.
Referenced by ExplainNode(), and show_modifytable_info().
|
static |
Definition at line 4267 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), EXPLAIN_FORMAT_TEXT, ExplainIndentText(), ExplainPropertyInteger(), ExplainPropertyUInteger(), ExplainState::format, ExplainState::str, UINT64_FORMAT, and usage().
Referenced by ExplainNode().
|
static |
Definition at line 2900 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), config_generic::context, ExplainState::deparse_cxt, ExplainPropertyText(), FRAMEOPTION_NONDEFAULT, WindowAgg::frameOptions, get_window_frame_options_for_explain(), initStringInfo(), lcons(), list_delete_first(), WindowAgg::ordNumCols, outerPlanState, WindowAgg::partNumCols, pfree(), PlanState::plan, ScanState::ps, quote_identifier(), ExplainState::rtable_size, set_deparse_context_plan(), show_window_keys(), WindowAggState::ss, ExplainState::verbose, and WindowAgg::winname.
Referenced by ExplainNode().
|
static |
Definition at line 2963 of file explain.c.
References appendStringInfoString(), buf, config_generic::context, ExplainState::deparse_cxt, deparse_expression(), elog, ERROR, TargetEntry::expr, get_tle_by_resno(), pfree(), PlanState::plan, plan, ExplainState::rtable_size, set_deparse_context_plan(), and ExplainState::verbose.
Referenced by show_window_def().
|
static |
Definition at line 3502 of file explain.c.
References ExplainState::analyze, WindowAggState::buffer, show_storage_info(), and tuplestore_get_stats().
Referenced by ExplainNode().
void standard_ExplainOneQuery | ( | Query * | query, |
int | cursorOptions, | ||
IntoClause * | into, | ||
ExplainState * | es, | ||
const char * | queryString, | ||
ParamListInfo | params, | ||
QueryEnvironment * | queryEnv | ||
) |
Definition at line 318 of file explain.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ExplainState::buffers, BufferUsageAccumDiff(), CurrentMemoryContext, ExplainOnePlan(), INSTR_TIME_SET_CURRENT, INSTR_TIME_SUBTRACT, ExplainState::memory, MemoryContextMemConsumed(), MemoryContextSwitchTo(), pg_plan_query(), pgBufferUsage, and plan.
Referenced by ExplainOneQuery().
explain_get_index_name_hook_type explain_get_index_name_hook = NULL |
Definition at line 53 of file explain.c.
Referenced by explain_get_index_name().
explain_per_node_hook_type explain_per_node_hook = NULL |
Definition at line 57 of file explain.c.
Referenced by ExplainNode().
explain_per_plan_hook_type explain_per_plan_hook = NULL |
Definition at line 56 of file explain.c.
Referenced by ExplainOnePlan().
ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL |
Definition at line 50 of file explain.c.
Referenced by ExplainOneQuery().