• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: Commit

firtst release


Commit MetaInfo

Revision501fdfce138690880661839510642f56cc26e669 (tree)
Time2022-01-19 15:12:22
AuthorKyotaro Horiguchi <horikyota.ntt@gmai...>
CommiterKyotaro Horiguchi

Log Message

Add forgotten test files

9e2f8b6 forgot to contain the .sql and expected/.out files for
hints_anywhere feature. Add them.

Change Summary

Incremental Difference

--- /dev/null
+++ b/expected/hints_anywhere.out
@@ -0,0 +1,83 @@
1+LOAD 'pg_hint_plan';
2+SET client_min_messages TO log;
3+\set SHOW_CONTEXT always
4+SET pg_hint_plan.debug_print TO on;
5+explain (costs false)
6+select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> '';
7+ QUERY PLAN
8+--------------------------------------
9+ Merge Join
10+ Merge Cond: (t1.id = t2.id)
11+ -> Index Scan using t1_pkey on t1
12+ -> Index Scan using t2_pkey on t2
13+(4 rows)
14+
15+set pg_hint_plan.hints_anywhere = on;
16+explain (costs false)
17+select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> '';
18+LOG: pg_hint_plan:
19+used hint:
20+HashJoin(t1 t2)
21+not used hint:
22+duplication hint:
23+error hint:
24+
25+ QUERY PLAN
26+------------------------------
27+ Hash Join
28+ Hash Cond: (t1.id = t2.id)
29+ -> Seq Scan on t1
30+ -> Hash
31+ -> Seq Scan on t2
32+(5 rows)
33+
34+set pg_hint_plan.hints_anywhere = off;
35+explain (costs false)
36+select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> '';
37+ QUERY PLAN
38+--------------------------------------
39+ Merge Join
40+ Merge Cond: (t1.id = t2.id)
41+ -> Index Scan using t1_pkey on t1
42+ -> Index Scan using t2_pkey on t2
43+(4 rows)
44+
45+set pg_hint_plan.hints_anywhere = on;
46+/*+ MergeJoin(t1 t2) */
47+explain (costs false)
48+select * from t1 join t2 on t1.val = t2.val where '/*+HashJoin(t1 t2)*/' <> '';
49+LOG: pg_hint_plan:
50+used hint:
51+MergeJoin(t1 t2)
52+not used hint:
53+duplication hint:
54+error hint:
55+
56+ QUERY PLAN
57+-------------------------------------------
58+ Merge Join
59+ Merge Cond: (t2.val = t1.val)
60+ -> Index Scan using t2_val on t2
61+ -> Materialize
62+ -> Index Scan using t1_val on t1
63+(5 rows)
64+
65+/*+ HashJoin(t1 t2) */
66+explain (costs false)
67+select * from t1 join t2 on t1.val = t2.val where '/*+MergeJoin(t1 t2)*/' <> '';
68+LOG: pg_hint_plan:
69+used hint:
70+HashJoin(t1 t2)
71+not used hint:
72+duplication hint:
73+error hint:
74+
75+ QUERY PLAN
76+--------------------------------
77+ Hash Join
78+ Hash Cond: (t2.val = t1.val)
79+ -> Seq Scan on t2
80+ -> Hash
81+ -> Seq Scan on t1
82+(5 rows)
83+
--- /dev/null
+++ b/sql/hints_anywhere.sql
@@ -0,0 +1,24 @@
1+LOAD 'pg_hint_plan';
2+SET client_min_messages TO log;
3+\set SHOW_CONTEXT always
4+SET pg_hint_plan.debug_print TO on;
5+
6+explain (costs false)
7+select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> '';
8+
9+set pg_hint_plan.hints_anywhere = on;
10+explain (costs false)
11+select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> '';
12+
13+set pg_hint_plan.hints_anywhere = off;
14+explain (costs false)
15+select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> '';
16+
17+set pg_hint_plan.hints_anywhere = on;
18+/*+ MergeJoin(t1 t2) */
19+explain (costs false)
20+select * from t1 join t2 on t1.val = t2.val where '/*+HashJoin(t1 t2)*/' <> '';
21+
22+/*+ HashJoin(t1 t2) */
23+explain (costs false)
24+select * from t1 join t2 on t1.val = t2.val where '/*+MergeJoin(t1 t2)*/' <> '';
Show on old repository browser