|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "pg_plan_advice.h"#include "pgpa_identifier.h"#include "pgpa_output.h"#include "pgpa_planner.h"#include "pgpa_trove.h"#include "pgpa_walker.h"#include "commands/defrem.h"#include "common/hashfn_unstable.h"#include "nodes/makefuncs.h"#include "optimizer/extendplan.h"#include "optimizer/pathnode.h"#include "optimizer/paths.h"#include "optimizer/plancat.h"#include "optimizer/planner.h"#include "parser/parsetree.h"#include "utils/lsyscache.h"
Go to the source code of this file.
Data Structures | |
| struct | pgpa_planner_state |
| struct | pgpa_join_state |
Typedefs | |
| typedef enum pgpa_jo_outcome | pgpa_jo_outcome |
| typedef struct pgpa_planner_state | pgpa_planner_state |
| typedef struct pgpa_join_state | pgpa_join_state |
Enumerations | |
| enum | pgpa_jo_outcome { PGPA_JO_PERMITTED , PGPA_JO_DENIED , PGPA_JO_INDIFFERENT } |
| Enumerator | |
|---|---|
| PGPA_JO_PERMITTED | |
| PGPA_JO_DENIED | |
| PGPA_JO_INDIFFERENT | |
Definition at line 84 of file pgpa_planner.c.
Definition at line 2148 of file pgpa_planner.c.
References appendStringInfo(), bms_is_empty, bms_next_member(), buf, fb(), initStringInfo(), and x.
Referenced by pgpa_join_path_setup(), and pgpa_joinrel_setup().
|
static |
Definition at line 459 of file pgpa_planner.c.
References ereport, errmsg, fb(), GetPlannerGlobalExtensionState(), pg_plan_advice_trace_mask, pgpa_compute_identifier_by_rti(), pgpa_planner_apply_scan_advice(), pgpa_ri_checker_save(), pgpa_trove_lookup(), PGPA_TROVE_LOOKUP_REL, PGPA_TROVE_LOOKUP_SCAN, RelOptInfo::pgs_mask, planner_extension_id, prev_build_simple_rel, RelOptInfo::relid, root, and WARNING.
Referenced by pgpa_planner_install_hooks().
|
static |
Definition at line 676 of file pgpa_planner.c.
References bms_num_members(), pgpa_trove_result::entries, fb(), GetPlannerGlobalExtensionState(), GetRelOptInfoExtensionState(), pgpa_trove_result::indexes, palloc0_object, palloc_array, pgpa_compute_identifiers_by_relids(), pgpa_trove_lookup(), PGPA_TROVE_LOOKUP_JOIN, PGPA_TROVE_LOOKUP_REL, planner_extension_id, RelOptInfo::relids, root, and SetRelOptInfoExtensionState().
Referenced by pgpa_join_path_setup(), and pgpa_joinrel_setup().
|
static |
Definition at line 1413 of file pgpa_planner.c.
References Assert, fb(), pgpa_trove_entry::flags, pgpa_identifiers_match_target(), PGPA_ITM_DISJOINT, PGPA_ITM_EQUAL, PGPA_ITM_KEYS_ARE_SUBSET, PGPA_ITM_TARGETS_ARE_SUBSET, PGPA_TARGET_IDENTIFIER, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, pgpa_trove_entry::target, and pgpa_advice_target::ttype.
Referenced by pgpa_planner_apply_join_path_advice().
|
static |
Definition at line 1247 of file pgpa_planner.c.
References Assert, pgpa_advice_target::children, fb(), pgpa_trove_entry::flags, foreach_ptr, list_copy_head(), list_free(), list_length(), list_nth(), palloc0_object, pgpa_identifiers_match_target(), PGPA_ITM_EQUAL, PGPA_ITM_KEYS_ARE_SUBSET, PGPA_ITM_TARGETS_ARE_SUBSET, PGPA_JO_DENIED, PGPA_JO_INDIFFERENT, PGPA_JO_PERMITTED, PGPA_TARGET_IDENTIFIER, PGPA_TARGET_ORDERED_LIST, PGPA_TARGET_UNORDERED_LIST, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, pgpa_trove_entry::target, and pgpa_advice_target::ttype.
Referenced by pgpa_planner_apply_join_path_advice().
|
static |
Definition at line 576 of file pgpa_planner.c.
References Assert, bms_equal(), bms_membership(), BMS_MULTIPLE, ereport, errmsg, fb(), foreach_ptr, GetPlannerGlobalExtensionState(), JOIN_UNIQUE_INNER, JOIN_UNIQUE_OUTER, lappend(), palloc_object, pg_plan_advice_trace_mask, pgpa_bms_to_cstring(), pgpa_get_join_state(), pgpa_jointype_to_cstring(), pgpa_planner_apply_join_path_advice(), JoinPathExtraData::pgs_mask, planner_extension_id, prev_join_path_setup, RelOptInfo::relids, root, and WARNING.
Referenced by pgpa_planner_install_hooks().
|
static |
Definition at line 1208 of file pgpa_planner.c.
References PGPA_TAG_FOREIGN_JOIN, PGPA_TAG_HASH_JOIN, PGPA_TAG_MERGE_JOIN_MATERIALIZE, PGPA_TAG_MERGE_JOIN_PLAIN, PGPA_TAG_NESTED_LOOP_MATERIALIZE, PGPA_TAG_NESTED_LOOP_MEMOIZE, PGPA_TAG_NESTED_LOOP_PLAIN, PGS_FOREIGNJOIN, PGS_HASHJOIN, PGS_MERGEJOIN_MATERIALIZE, PGS_MERGEJOIN_PLAIN, PGS_NESTLOOP_MATERIALIZE, PGS_NESTLOOP_MEMOIZE, and PGS_NESTLOOP_PLAIN.
Referenced by pgpa_planner_apply_join_path_advice().
|
static |
Definition at line 526 of file pgpa_planner.c.
References Assert, bms_membership(), BMS_MULTIPLE, ereport, errmsg, fb(), pg_plan_advice_trace_mask, pgpa_bms_to_cstring(), pgpa_get_join_state(), pgpa_planner_apply_joinrel_advice(), RelOptInfo::pgs_mask, prev_joinrel_setup, RelOptInfo::relids, root, and WARNING.
Referenced by pgpa_planner_install_hooks().
Definition at line 2172 of file pgpa_planner.c.
References JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, JOIN_RIGHT_ANTI, JOIN_RIGHT_SEMI, JOIN_SEMI, JOIN_UNIQUE_INNER, and JOIN_UNIQUE_OUTER.
Referenced by pgpa_join_path_setup().
|
static |
Definition at line 1519 of file pgpa_planner.c.
References fb(), pgpa_trove_entry::flags, pgpa_identifiers_match_target(), PGPA_ITM_EQUAL, PGPA_ITM_KEYS_ARE_SUBSET, PGPA_ITM_TARGETS_ARE_SUBSET, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, and pgpa_trove_entry::target.
Referenced by pgpa_planner_apply_join_path_advice().
|
static |
Definition at line 1920 of file pgpa_planner.c.
References fb(), pgpa_trove_entry::flags, i, lappend(), makeDefElem(), makeInteger(), pgpa_cstring_trove_entry(), PGPA_TE_FAILED, PGPA_TE_MATCH_FULL, pgpa_trove_lookup_all(), pgpa_walker_would_advise(), pgpa_trove_entry::tag, pgpa_trove_entry::target, and type.
Referenced by pgpa_planner_shutdown().
|
static |
Definition at line 989 of file pgpa_planner.c.
References bms_add_member(), bms_next_member(), fb(), pgpa_trove_entry::flags, i, JOIN_RIGHT_SEMI, JOIN_SEMI, JOIN_UNIQUE_INNER, JOIN_UNIQUE_OUTER, pgpa_identifiers_match_target(), PGPA_ITM_EQUAL, PGPA_ITM_TARGETS_ARE_SUBSET, PGPA_JO_DENIED, PGPA_JO_PERMITTED, pgpa_join_method_permits_join(), pgpa_join_order_permits_join(), pgpa_join_strategy_mask_from_advice_tag(), pgpa_opaque_join_permits_join(), pgpa_semijoin_permits_join(), PGPA_TAG_FOREIGN_JOIN, PGPA_TAG_JOIN_ORDER, PGPA_TAG_PARTITIONWISE, PGPA_TAG_SEMIJOIN_NON_UNIQUE, PGPA_TAG_SEMIJOIN_UNIQUE, PGPA_TE_CONFLICTING, PGPA_TE_INAPPLICABLE, pgpa_trove_set_flags(), PGS_JOIN_ANY, pgpa_trove_entry::tag, and pgpa_trove_entry::target.
Referenced by pgpa_join_path_setup().
|
static |
Definition at line 793 of file pgpa_planner.c.
References Assert, bms_add_member(), bms_next_member(), elog, ERROR, fb(), i, pgpa_identifiers_match_target(), PGPA_ITM_DISJOINT, PGPA_ITM_EQUAL, PGPA_ITM_KEYS_ARE_SUBSET, PGPA_ITM_TARGETS_ARE_SUBSET, PGPA_TAG_GATHER, PGPA_TAG_GATHER_MERGE, PGPA_TAG_NO_GATHER, PGPA_TAG_PARTITIONWISE, PGPA_TE_CONFLICTING, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, pgpa_trove_set_flags(), PGS_APPEND, PGS_CONSIDER_NONPARTIAL, PGS_GATHER, PGS_GATHER_MERGE, PGS_MERGE_APPEND, pgpa_trove_entry::tag, and pgpa_trove_entry::target.
Referenced by pgpa_joinrel_setup().
|
static |
Definition at line 1674 of file pgpa_planner.c.
References Assert, bms_add_member(), bms_next_member(), fb(), foreach_node, get_namespace_name_or_temp(), get_rel_name(), get_rel_namespace(), i, RelOptInfo::indexlist, pgpa_index_target::indname, pgpa_index_target::indnamespace, list_length(), pgpa_index_targets_equal(), PGPA_TAG_BITMAP_HEAP_SCAN, PGPA_TAG_GATHER, PGPA_TAG_GATHER_MERGE, PGPA_TAG_INDEX_ONLY_SCAN, PGPA_TAG_INDEX_SCAN, PGPA_TAG_NO_GATHER, PGPA_TAG_PARTITIONWISE, PGPA_TAG_SEQ_SCAN, PGPA_TAG_TID_SCAN, PGPA_TARGET_IDENTIFIER, PGPA_TE_CONFLICTING, PGPA_TE_INAPPLICABLE, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, pgpa_trove_set_flags(), PGS_APPEND, PGS_BITMAPSCAN, PGS_CONSIDER_INDEXONLY, PGS_CONSIDER_NONPARTIAL, PGS_GATHER, PGS_GATHER_MERGE, PGS_INDEXONLYSCAN, PGS_INDEXSCAN, RelOptInfo::pgs_mask, PGS_MERGE_APPEND, PGS_SCAN_ANY, PGS_SEQSCAN, PGS_TIDSCAN, relname, pgpa_trove_entry::target, and pgpa_advice_target::ttype.
Referenced by pgpa_build_simple_rel().
Definition at line 1957 of file pgpa_planner.c.
References appendStringInfo(), appendStringInfoChar(), defGetInt32(), ereport, errdetail(), errmsg, fb(), foreach_node, initStringInfo(), NIL, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, pgpa_trove_append_flags(), resetStringInfo(), and WARNING.
Referenced by pgpa_planner_shutdown().
Definition at line 226 of file pgpa_planner.c.
References build_simple_rel_hook, GetPlannerExtensionId(), join_path_setup_hook, joinrel_setup_hook, pgpa_build_simple_rel(), pgpa_join_path_setup(), pgpa_joinrel_setup(), pgpa_planner_setup(), pgpa_planner_shutdown(), planner_extension_id, planner_setup_hook, planner_shutdown_hook, prev_build_simple_rel, prev_join_path_setup, prev_joinrel_setup, prev_planner_setup, and prev_planner_shutdown.
Referenced by _PG_init().
|
static |
Definition at line 245 of file pgpa_planner.c.
References CurrentMemoryContext, ereport, errmsg, error(), fb(), NIL, palloc0_object, parse(), pg_plan_advice_always_store_advice_details, pg_plan_advice_feedback_warnings, pg_plan_advice_get_supplied_query_advice(), pg_plan_advice_should_explain(), pgpa_build_trove(), pgpa_parse(), pgpa_planner_generate_advice, planner_extension_id, prev_planner_setup, SetPlannerGlobalExtensionState(), and WARNING.
Referenced by pgpa_planner_install_hooks().
|
static |
Definition at line 351 of file pgpa_planner.c.
References buf, PlannedStmt::extension_state, fb(), GetPlannerGlobalExtensionState(), initStringInfo(), lappend(), makeDefElem(), makeString(), NIL, parse(), pg_plan_advice_feedback_warnings, pgpa_create_identifiers_for_planned_stmt(), pgpa_output_advice(), pgpa_plan_walker(), pgpa_planner_append_feedback(), pgpa_planner_feedback_warning(), pgpa_ri_checker_validate(), PGPA_TROVE_LOOKUP_JOIN, PGPA_TROVE_LOOKUP_REL, PGPA_TROVE_LOOKUP_SCAN, planner_extension_id, and prev_planner_shutdown.
Referenced by pgpa_planner_install_hooks().
|
inlinestatic |
Definition at line 2039 of file pgpa_planner.c.
References Assert, bms_singleton_member(), fb(), pgpa_compute_identifier_by_rti(), pgpa_identifier_string(), RelOptInfo::relids, and root.
Referenced by pgpa_build_simple_rel().
|
static |
Definition at line 2064 of file pgpa_planner.c.
References Assert, fb(), foreach_node, list_length(), pgpa_create_identifiers_for_planned_stmt(), pgpa_identifier_string(), PlannedStmt::rtable, and PlannedStmt::subrtinfos.
Referenced by pgpa_planner_shutdown().
|
static |
Definition at line 1584 of file pgpa_planner.c.
References Assert, fb(), pgpa_trove_entry::flags, pgpa_identifiers_match_target(), PGPA_ITM_DISJOINT, PGPA_ITM_EQUAL, PGPA_ITM_KEYS_ARE_SUBSET, PGPA_ITM_TARGETS_ARE_SUBSET, PGPA_TE_MATCH_FULL, PGPA_TE_MATCH_PARTIAL, and pgpa_trove_entry::target.
Referenced by pgpa_planner_apply_join_path_advice().
| int pgpa_planner_generate_advice = 0 |
Definition at line 146 of file pgpa_planner.c.
Referenced by pg_plan_advice_request_advice_generation(), and pgpa_planner_setup().
|
static |
Definition at line 147 of file pgpa_planner.c.
Referenced by pgpa_build_simple_rel(), pgpa_get_join_state(), pgpa_join_path_setup(), pgpa_planner_install_hooks(), pgpa_planner_setup(), and pgpa_planner_shutdown().
|
static |
Definition at line 139 of file pgpa_planner.c.
Referenced by pgpa_build_simple_rel(), and pgpa_planner_install_hooks().
|
static |
Definition at line 140 of file pgpa_planner.c.
Referenced by pgpa_join_path_setup(), and pgpa_planner_install_hooks().
|
static |
Definition at line 141 of file pgpa_planner.c.
Referenced by pgpa_joinrel_setup(), and pgpa_planner_install_hooks().
|
static |
Definition at line 142 of file pgpa_planner.c.
Referenced by pgpa_planner_install_hooks(), and pgpa_planner_setup().
|
static |
Definition at line 143 of file pgpa_planner.c.
Referenced by pgpa_planner_install_hooks(), and pgpa_planner_shutdown().