forked from greenplum-db/gpdb-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Planhints logging (#17398)
Add support for plan hints logging. This commit supports logging of Used and Not Used Scan, Row, JoinOrder and JoinTypeHints. Hints logging is controlled by guc : `pg_hint_plan.debug_print` for both ORCA/Planner. If the guc is set and optimizer is turned on, then ORCA plan hint logs are shown and if optimizer is turned off, then Planner logs are shown. If there's a fallback then, Planner logs are shown. Below is a snippet of how this can be used/looks like: ``` SET client_min_messages TO LOG; SET pg_hint_plan.debug_print TO ON; /*+ IndexScan(t1 my_incredible_index) IndexScan(t3 our_amazing_index) */ EXPLAIN (costs off) SELECT t1.a, t2.a, t3.a FROM my_table AS t1 JOIN your_table AS t2 ON t1.a=t2.a JOIN our_table AS t3 ON t3.a=t2.a WHERE t1.a<42; LOG: statement: IndexScan(t1 my_incredible_index) IndexScan(t3 our_amazing_index) EXPLAIN (costs off) SELECT t1.a, t2.a, t3.a FROM my_table AS t1 JOIN your_table AS t2 ON t1.a=t2.a JOIN our_table AS t3 ON t3.a=t2.a WHERE t1.a<42; LOG: 2024-04-25 10:21:22:363407 CDT,THD000,TRACE,"PlanHint: [ used hint: ScanHint: t1[indexes:my_incredible_index types:IndexScan] ScanHint: t3[indexes:our_amazing_index types:IndexScan] not used hint: ]", QUERY PLAN ----------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (t2.a = t3.a) -> Nested Loop Join Filter: true -> Index Only Scan using your_awesome_index on your_table t2yml Index Cond: (a < 42) -> Index Scan using my_incredible_index on my_table t1 Index Cond: ((a = t2.a) AND (a < 42)) -> Hash -> Dynamic Index Scan on our_amazing_index on our_table t3 Index Cond: (a < 42) Number of partitions to scan: 4 (out of 4) Optimizer: GPORCA (14 rows) ```
- Loading branch information
Showing
21 changed files
with
3,975 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.