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/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.
Data Structures | |
struct | SerializeMetrics |
struct | SerializeDestReceiver |
Macros | |
#define | X_OPENING 0 |
#define | X_CLOSING 1 |
#define | X_CLOSE_IMMEDIATE 2 |
#define | X_NOWHITESPACE 4 |
#define | BYTES_TO_KILOBYTES(b) (((b) + 1023) / 1024) |
Typedefs | |
typedef struct SerializeMetrics | SerializeMetrics |
typedef struct SerializeDestReceiver | SerializeDestReceiver |
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_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_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) |
static void | ExplainProperty (const char *qlabel, const char *unit, const char *value, bool numeric, ExplainState *es) |
static void | ExplainOpenSetAsideGroup (const char *objtype, const char *labelname, bool labeled, int depth, ExplainState *es) |
static void | ExplainSaveGroup (ExplainState *es, int depth, int *state_save) |
static void | ExplainRestoreGroup (ExplainState *es, int depth, int *state_save) |
static void | ExplainDummyGroup (const char *objtype, const char *labelname, ExplainState *es) |
static void | ExplainXMLTag (const char *tagname, int flags, ExplainState *es) |
static void | ExplainIndentText (ExplainState *es) |
static void | ExplainJSONLineEnding (ExplainState *es) |
static void | ExplainYAMLLineStarting (ExplainState *es) |
static void | escape_yaml (StringInfo buf, const char *str) |
static SerializeMetrics | GetSerializationMetrics (DestReceiver *dest) |
void | ExplainQuery (ParseState *pstate, ExplainStmt *stmt, ParamListInfo params, DestReceiver *dest) |
ExplainState * | NewExplainState (void) |
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, 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) |
void | ExplainPropertyList (const char *qlabel, List *data, ExplainState *es) |
void | ExplainPropertyListNested (const char *qlabel, List *data, ExplainState *es) |
void | ExplainPropertyText (const char *qlabel, const char *value, ExplainState *es) |
void | ExplainPropertyInteger (const char *qlabel, const char *unit, int64 value, ExplainState *es) |
void | ExplainPropertyUInteger (const char *qlabel, const char *unit, uint64 value, ExplainState *es) |
void | ExplainPropertyFloat (const char *qlabel, const char *unit, double value, int ndigits, ExplainState *es) |
void | ExplainPropertyBool (const char *qlabel, bool value, ExplainState *es) |
void | ExplainOpenGroup (const char *objtype, const char *labelname, bool labeled, ExplainState *es) |
void | ExplainCloseGroup (const char *objtype, const char *labelname, bool labeled, ExplainState *es) |
void | ExplainBeginOutput (ExplainState *es) |
void | ExplainEndOutput (ExplainState *es) |
void | ExplainSeparatePlans (ExplainState *es) |
static void | serialize_prepare_info (SerializeDestReceiver *receiver, TupleDesc typeinfo, int nattrs) |
static bool | serializeAnalyzeReceive (TupleTableSlot *slot, DestReceiver *self) |
static void | serializeAnalyzeStartup (DestReceiver *self, int operation, TupleDesc typeinfo) |
static void | serializeAnalyzeShutdown (DestReceiver *self) |
static void | serializeAnalyzeDestroy (DestReceiver *self) |
DestReceiver * | CreateExplainSerializeDestReceiver (ExplainState *es) |
Variables | |
ExplainOneQuery_hook_type | ExplainOneQuery_hook = NULL |
explain_get_index_name_hook_type | explain_get_index_name_hook = NULL |
typedef struct SerializeDestReceiver SerializeDestReceiver |
typedef struct SerializeMetrics SerializeMetrics |
DestReceiver* CreateExplainSerializeDestReceiver | ( | ExplainState * | es | ) |
Definition at line 5876 of file explain.c.
References DestExplainSerialize, palloc0(), serializeAnalyzeDestroy(), serializeAnalyzeReceive(), serializeAnalyzeShutdown(), and serializeAnalyzeStartup().
Referenced by CreateDestReceiver(), and ExplainOnePlan().
|
static |
Definition at line 1305 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 5619 of file explain.c.
References buf, escape_json(), and str.
Referenced by ExplainDummyGroup(), ExplainProperty(), ExplainPropertyList(), and ExplainPropertyListNested().
|
static |
Definition at line 3999 of file explain.c.
References elog, ERROR, explain_get_index_name_hook, and get_rel_name().
Referenced by ExplainIndexScanDetails(), and ExplainNode().
void ExplainBeginOutput | ( | ExplainState * | es | ) |
Definition at line 5443 of file explain.c.
References appendStringInfoChar(), appendStringInfoString(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, lcons_int(), and ExplainState::str.
Referenced by explain_ExecutorEnd(), and ExplainQuery().
void ExplainCloseGroup | ( | const char * | objtype, |
const char * | labelname, | ||
bool | labeled, | ||
ExplainState * | es | ||
) |
Definition at line 5250 of file explain.c.
References appendStringInfoChar(), appendStringInfoSpaces(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainXMLTag(), ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, list_delete_first(), ExplainState::str, and X_CLOSING.
Referenced by ExplainFlushWorkersState(), ExplainNode(), ExplainOnePlan(), ExplainPrintJIT(), ExplainPrintSerialize(), ExplainPrintSettings(), ExplainPrintTriggers(), report_triggers(), show_grouping_set_keys(), show_grouping_sets(), show_incremental_sort_group_info(), and show_modifytable_info().
|
static |
Definition at line 4880 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 4801 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 4779 of file explain.c.
References CustomScanState::custom_ps, ExplainNode(), label, lfirst, and list_length().
Referenced by ExplainNode().
|
static |
Definition at line 5397 of file explain.c.
References appendStringInfoSpaces(), appendStringInfoString(), escape_json(), escape_yaml(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainJSONLineEnding(), ExplainXMLTag(), ExplainYAMLLineStarting(), ExplainState::format, ExplainState::indent, ExplainState::str, and X_CLOSE_IMMEDIATE.
Referenced by ExplainOneUtility().
void ExplainEndOutput | ( | ExplainState * | es | ) |
Definition at line 5474 of file explain.c.
References appendStringInfoString(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, list_delete_first(), and ExplainState::str.
Referenced by explain_ExecutorEnd(), and ExplainQuery().
|
static |
Definition at line 4916 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 5559 of file explain.c.
References appendStringInfoSpaces(), Assert, StringInfoData::data, EXPLAIN_FORMAT_TEXT, ExplainState::format, ExplainState::indent, StringInfoData::len, and ExplainState::str.
Referenced by ExplainNode(), ExplainOnePlan(), ExplainOpenWorker(), ExplainPrintJIT(), ExplainPrintSerialize(), ExplainProperty(), ExplainPropertyList(), show_buffer_usage(), show_hash_info(), show_hashagg_info(), show_memoize_info(), show_memory_counters(), show_modifytable_info(), show_sort_info(), show_storage_info(), show_tablesample(), show_tidbitmap_info(), and show_wal_usage().
|
static |
Definition at line 4296 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 5574 of file explain.c.
References appendStringInfoChar(), Assert, EXPLAIN_FORMAT_JSON, ExplainState::format, ExplainState::grouping_stack, linitial_int, and ExplainState::str.
Referenced by ExplainDummyGroup(), ExplainOpenGroup(), ExplainProperty(), ExplainPropertyList(), and ExplainPropertyListNested().
|
static |
Definition at line 4704 of file explain.c.
References ExplainNode(), and j.
Referenced by ExplainNode().
|
static |
Definition at line 4722 of file explain.c.
References EXPLAIN_FORMAT_TEXT, ExplainPropertyInteger(), and format.
Referenced by ExplainNode().
|
static |
Definition at line 4345 of file explain.c.
References ExplainTargetRel(), and plan.
Referenced by ExplainNode().
|
static |
Definition at line 1489 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(), ExplainCloseGroup(), ExplainCloseWorker(), ExplainCreateWorkersState(), ExplainCustomChildren(), CustomExecMethods::ExplainCustomScan, ExplainFlushWorkersState(), ExplainIndentText(), ExplainIndexScanDetails(), ExplainMemberNodes(), ExplainMissingMembers(), ExplainModifyTarget(), 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_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_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(), ExplainPrintPlan(), and ExplainSubPlans().
void ExplainOnePlan | ( | PlannedStmt * | plannedstmt, |
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 637 of file explain.c.
References ExplainState::analyze, appendStringInfoString(), Assert, ExplainState::buffers, CMD_UTILITY, CommandCounterIncrement(), PlannedStmt::commandType, ExplainState::costs, CreateExplainSerializeDestReceiver(), CreateIntoRelDestReceiver(), CreateQueryDesc(), generate_unaccent_rules::dest, elapsed_time(), EXEC_FLAG_EXPLAIN_GENERIC, EXEC_FLAG_EXPLAIN_ONLY, ExecutorEnd(), ExecutorFinish(), ExecutorRun(), ExecutorStart(), EXPLAIN_FORMAT_TEXT, 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(), 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 436 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 533 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().
void ExplainOpenGroup | ( | const char * | objtype, |
const char * | labelname, | ||
bool | labeled, | ||
ExplainState * | es | ||
) |
Definition at line 5187 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), escape_json(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainJSONLineEnding(), ExplainXMLTag(), ExplainYAMLLineStarting(), ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, lcons_int(), ExplainState::str, and X_OPENING.
Referenced by ExplainFlushWorkersState(), ExplainNode(), ExplainOnePlan(), ExplainPrintJIT(), ExplainPrintSerialize(), ExplainPrintSettings(), ExplainPrintTriggers(), report_triggers(), show_grouping_set_keys(), show_grouping_sets(), show_incremental_sort_group_info(), and show_modifytable_info().
|
static |
Definition at line 5297 of file explain.c.
References EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, and lcons_int().
Referenced by ExplainOpenWorker().
|
static |
Definition at line 4818 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 1324 of file explain.c.
References bms_add_member(), bms_add_members(), nodeTag, PlanState::plan, plan, and planstate_tree_walker.
Referenced by ExplainPrintPlan().
|
static |
Definition at line 1043 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 1017 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 897 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(), and ExplainState::verbose.
Referenced by explain_ExecutorEnd(), and ExplainOnePlan().
|
static |
Definition at line 1141 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 827 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 974 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().
|
static |
Definition at line 5069 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), escape_json(), escape_xml(), escape_yaml(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainIndentText(), ExplainJSONLineEnding(), ExplainXMLTag(), ExplainYAMLLineStarting(), ExplainState::format, ExplainState::indent, pfree(), ExplainState::str, str, value, X_CLOSING, X_NOWHITESPACE, and X_OPENING.
Referenced by ExplainPropertyBool(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainPropertyText(), and ExplainPropertyUInteger().
void ExplainPropertyBool | ( | const char * | qlabel, |
bool | value, | ||
ExplainState * | es | ||
) |
Definition at line 5172 of file explain.c.
References ExplainProperty(), and value.
Referenced by ExplainNode(), and ExplainPrintJIT().
void ExplainPropertyFloat | ( | const char * | qlabel, |
const char * | unit, | ||
double | value, | ||
int | ndigits, | ||
ExplainState * | es | ||
) |
Definition at line 5158 of file explain.c.
References buf, ExplainProperty(), pfree(), psprintf(), and value.
Referenced by ExplainNode(), ExplainOnePlan(), ExplainPrintJIT(), ExplainPrintSerialize(), report_triggers(), show_buffer_usage(), show_instrumentation_count(), and show_modifytable_info().
void ExplainPropertyInteger | ( | const char * | qlabel, |
const char * | unit, | ||
int64 | value, | ||
ExplainState * | es | ||
) |
Definition at line 5131 of file explain.c.
References buf, ExplainProperty(), INT64_FORMAT, snprintf, and value.
Referenced by ExplainMissingMembers(), ExplainNode(), ExplainOpenWorker(), ExplainPrintJIT(), ExplainPrintPlan(), fileExplainForeignScan(), postgresExplainForeignModify(), show_buffer_usage(), show_hash_info(), show_hashagg_info(), show_incremental_sort_group_info(), show_memoize_info(), show_memory_counters(), show_sort_info(), show_storage_info(), and show_wal_usage().
void ExplainPropertyList | ( | const char * | qlabel, |
List * | data, | ||
ExplainState * | es | ||
) |
Definition at line 4946 of file explain.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), data, escape_json(), escape_xml(), escape_yaml(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainIndentText(), ExplainJSONLineEnding(), ExplainXMLTag(), ExplainYAMLLineStarting(), ExplainState::format, ExplainState::indent, lfirst, pfree(), ExplainState::str, str, X_CLOSING, and X_OPENING.
Referenced by ExplainPropertyListNested(), show_incremental_sort_group_info(), show_modifytable_info(), show_plan_tlist(), show_sort_group_keys(), and show_tablesample().
void ExplainPropertyListNested | ( | const char * | qlabel, |
List * | data, | ||
ExplainState * | es | ||
) |
Definition at line 5016 of file explain.c.
References appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), data, escape_json(), escape_yaml(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainJSONLineEnding(), ExplainPropertyList(), ExplainYAMLLineStarting(), ExplainState::format, ExplainState::indent, lfirst, and ExplainState::str.
Referenced by show_grouping_set_keys().
void ExplainPropertyText | ( | const char * | qlabel, |
const char * | value, | ||
ExplainState * | es | ||
) |
Definition at line 5122 of file explain.c.
References ExplainProperty(), and value.
Referenced by ExplainIndexScanDetails(), ExplainNode(), ExplainPrintSerialize(), ExplainPrintSettings(), ExplainQueryParameters(), ExplainQueryText(), ExplainTargetRel(), fileExplainForeignScan(), postgresExplainDirectModify(), postgresExplainForeignModify(), postgresExplainForeignScan(), report_triggers(), show_expression(), show_grouping_set_keys(), show_memoize_info(), show_modifytable_info(), show_sort_info(), show_storage_info(), and show_tablesample().
void ExplainPropertyUInteger | ( | const char * | qlabel, |
const char * | unit, | ||
uint64 | value, | ||
ExplainState * | es | ||
) |
Definition at line 5144 of file explain.c.
References buf, ExplainProperty(), snprintf, UINT64_FORMAT, and value.
Referenced by ExplainPrintSerialize(), show_hash_info(), show_tidbitmap_info(), and show_wal_usage().
void ExplainQuery | ( | ParseState * | pstate, |
ExplainStmt * | stmt, | ||
ParamListInfo | params, | ||
DestReceiver * | dest | ||
) |
Definition at line 191 of file explain.c.
References ExplainState::analyze, appendStringInfoString(), DefElem::arg, Assert, begin_tup_output_tupdesc(), ExplainState::buffers, castNode, ExplainState::costs, CURSOR_OPT_PARALLEL_OK, StringInfoData::data, defGetBoolean(), defGetString(), DefElem::defname, generate_unaccent_rules::dest, do_text_output_multiline(), do_text_output_oneline, end_tup_output(), ereport, errcode(), errmsg(), ERROR, EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, EXPLAIN_SERIALIZE_BINARY, EXPLAIN_SERIALIZE_NONE, EXPLAIN_SERIALIZE_TEXT, ExplainBeginOutput(), ExplainEndOutput(), ExplainOneQuery(), ExplainResultDesc(), ExplainSeparatePlans(), ExplainState::format, ExplainState::generic, if(), ExplainState::indent, IsQueryIdEnabled(), JumbleQuery(), lfirst, lfirst_node, lnext(), DefElem::location, ExplainState::memory, NewExplainState(), NIL, parser_errposition(), pfree(), post_parse_analyze_hook, QueryRewrite(), ExplainState::serialize, ExplainState::settings, stmt, ExplainState::str, ExplainState::summary, ExplainState::timing, TTSOpsVirtual, ExplainState::verbose, and ExplainState::wal.
Referenced by standard_ProcessUtility().
void ExplainQueryParameters | ( | ExplainState * | es, |
ParamListInfo | params, | ||
int | maxlen | ||
) |
Definition at line 1216 of file explain.c.
References BuildParamLogString(), ExplainPropertyText(), ParamListInfoData::numParams, and str.
Referenced by explain_ExecutorEnd().
void ExplainQueryText | ( | ExplainState * | es, |
QueryDesc * | queryDesc | ||
) |
Definition at line 1201 of file explain.c.
References ExplainPropertyText(), and QueryDesc::sourceText.
Referenced by explain_ExecutorEnd().
|
static |
Definition at line 5366 of file explain.c.
References EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, and lcons_int().
Referenced by ExplainOpenWorker().
TupleDesc ExplainResultDesc | ( | ExplainStmt * | stmt | ) |
Definition at line 397 of file explain.c.
References CreateTemplateTupleDesc(), defGetString(), DefElem::defname, lfirst, stmt, and TupleDescInitEntry().
Referenced by ExplainQuery(), and UtilityTupleDescriptor().
|
static |
Definition at line 5336 of file explain.c.
References EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, linitial_int, and list_delete_first().
Referenced by ExplainCloseWorker().
|
static |
Definition at line 4332 of file explain.c.
References ExplainTargetRel(), and plan.
Referenced by ExplainNode().
void ExplainSeparatePlans | ( | ExplainState * | es | ) |
Definition at line 5503 of file explain.c.
References appendStringInfoChar(), EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_YAML, ExplainState::format, and ExplainState::str.
Referenced by ExplainExecuteQuery(), and ExplainQuery().
|
static |
Definition at line 4736 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 4354 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 5532 of file explain.c.
References appendStringInfoChar(), appendStringInfoCharMacro, appendStringInfoSpaces(), appendStringInfoString(), ExplainState::indent, ExplainState::str, X_CLOSE_IMMEDIATE, X_CLOSING, and X_NOWHITESPACE.
Referenced by ExplainCloseGroup(), ExplainDummyGroup(), ExplainOpenGroup(), ExplainProperty(), and ExplainPropertyList().
|
static |
Definition at line 5594 of file explain.c.
References appendStringInfoChar(), appendStringInfoSpaces(), Assert, EXPLAIN_FORMAT_YAML, ExplainState::format, ExplainState::grouping_stack, ExplainState::indent, linitial_int, and ExplainState::str.
Referenced by ExplainDummyGroup(), ExplainOpenGroup(), ExplainProperty(), ExplainPropertyList(), and ExplainPropertyListNested().
|
static |
Definition at line 5901 of file explain.c.
References generate_unaccent_rules::dest, DestExplainSerialize, INSTR_TIME_SET_ZERO, and SerializeMetrics::timeSpent.
Referenced by ExplainOnePlan().
ExplainState* NewExplainState | ( | void | ) |
Definition at line 380 of file explain.c.
References ExplainState::costs, makeStringInfo(), palloc0(), and ExplainState::str.
Referenced by explain_ExecutorEnd(), and ExplainQuery().
|
static |
Definition at line 4023 of file explain.c.
References EXPLAIN_FORMAT_TEXT, ExplainState::format, INSTR_TIME_IS_ZERO, and usage().
Referenced by ExplainOnePlan(), and ExplainPrintSerialize().
Definition at line 1384 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 1234 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 5654 of file explain.c.
References SerializeDestReceiver::attrinfo, ereport, errcode(), errmsg(), ERROR, SerializeDestReceiver::finfos, fmgr_info(), SerializeDestReceiver::format, getTypeBinaryOutputInfo(), getTypeOutputInfo(), i, SerializeDestReceiver::nattrs, palloc0(), pfree(), and TupleDescAttr.
Referenced by serializeAnalyzeReceive().
|
static |
Definition at line 5867 of file explain.c.
References pfree().
Referenced by CreateExplainSerializeDestReceiver().
|
static |
Definition at line 5707 of file explain.c.
References SerializeDestReceiver::attrinfo, SerializeDestReceiver::buf, buf, ExplainState::buffers, SerializeMetrics::bufferUsage, BufferUsageAccumDiff(), SerializeMetrics::bytesSent, SerializeDestReceiver::es, SerializeDestReceiver::finfos, SerializeDestReceiver::format, i, INSTR_TIME_ACCUM_DIFF, INSTR_TIME_SET_CURRENT, MemoryContextReset(), MemoryContextSwitchTo(), SerializeDestReceiver::metrics, SerializeDestReceiver::nattrs, TupleDescData::natts, OutputFunctionCall(), pgBufferUsage, pq_beginmessage_reuse(), pq_sendbytes(), pq_sendcountedtext(), pq_sendint16(), pq_sendint32(), PqMsg_DataRow, SendFunctionCall(), serialize_prepare_info(), slot_getallattrs(), start, SerializeMetrics::timeSpent, ExplainState::timing,