firtst release
修订版 | f8b0032df46fe4a4940c611d0c6567cbe7685fcc (tree) |
---|---|
时间 | 2013-06-21 13:21:59 |
作者 | Takashi Suzuki <suzuki.takashi@metr...> |
Commiter | Takashi Suzuki |
既存機能の向上や新規機能の追加を考慮してリグレッションテストを更新した。
追加で以下の機能を試験するようにした。
・記述位置の自由度が向上したクエリコメント方式によるヒント取得機能
・ヒント用テーブル方式によるヒント取得機能
・ヒント用テーブル検索の制御機能
・plpgsqlで記述したクエリから、クエリコメント方式でヒントを取得する
@@ -115,6 +115,24 @@ error hint: | ||
115 | 115 | -> Seq Scan on t2 |
116 | 116 | (5 rows) |
117 | 117 | |
118 | +EXPLAIN (COSTS false) /*+Set(enable_indexscan off)*/ | |
119 | + SELECT * FROM t1, t2 WHERE t1.id = t2.id; | |
120 | +LOG: pg_hint_plan: | |
121 | +used hint: | |
122 | +Set(enable_indexscan off) | |
123 | +not used hint: | |
124 | +duplication hint: | |
125 | +error hint: | |
126 | + | |
127 | + QUERY PLAN | |
128 | +------------------------------ | |
129 | + Hash Join | |
130 | + Hash Cond: (t1.id = t2.id) | |
131 | + -> Seq Scan on t1 | |
132 | + -> Hash | |
133 | + -> Seq Scan on t2 | |
134 | +(5 rows) | |
135 | + | |
118 | 136 | /*+ Set(enable_indexscan off) Set(enable_hashjoin off) */ |
119 | 137 | EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; |
120 | 138 | LOG: pg_hint_plan: |
@@ -7859,3 +7877,58 @@ error hint: | ||
7859 | 7877 | Filter: (val = 1) |
7860 | 7878 | (20 rows) |
7861 | 7879 | |
7880 | +-- search from hint table | |
7881 | +INSERT INTO hint_plan.hints VALUES ('EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;', '', 'SeqScan(t1)'); | |
7882 | +SET pg_hint_plan.lookup_hint_in_table = on; | |
7883 | +EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1; | |
7884 | +LOG: pg_hint_plan: | |
7885 | +used hint: | |
7886 | +SeqScan(t1) | |
7887 | +not used hint: | |
7888 | +duplication hint: | |
7889 | +error hint: | |
7890 | + | |
7891 | + QUERY PLAN | |
7892 | +-------------------- | |
7893 | + Seq Scan on t1 | |
7894 | + Filter: (id = 1) | |
7895 | +(2 rows) | |
7896 | + | |
7897 | +SET pg_hint_plan.lookup_hint_in_table = off; | |
7898 | +EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1; | |
7899 | + | |
7900 | + QUERY PLAN | |
7901 | +-------------------------------- | |
7902 | + Index Scan using t1_pkey on t1 | |
7903 | + Index Cond: (id = 1) | |
7904 | +(2 rows) | |
7905 | + | |
7906 | +TRUNCATE hint_plan.hints; | |
7907 | +VACUUM ANALYZE; | |
7908 | +-- plpgsql test | |
7909 | +EXPLAIN SELECT id FROM t1 WHERE t1.id = 1; | |
7910 | + QUERY PLAN | |
7911 | +------------------------------------------------------------------ | |
7912 | + Index Scan using t1_pkey on t1 (cost=0.00..8.27 rows=1 width=4) | |
7913 | + Index Cond: (id = 1) | |
7914 | +(2 rows) | |
7915 | + | |
7916 | +SET client_min_messages = LOG; | |
7917 | +DO LANGUAGE plpgsql $$ | |
7918 | +DECLARE | |
7919 | + id integer; | |
7920 | +BEGIN | |
7921 | + SELECT /*+SeqScan(t1)*/ t1.id INTO id FROM t1 WHERE t1.id = 1; | |
7922 | + RETURN; | |
7923 | +END; | |
7924 | +$$; | |
7925 | +LOG: pg_hint_plan: | |
7926 | +used hint: | |
7927 | +SeqScan(t1) | |
7928 | +not used hint: | |
7929 | +duplication hint: | |
7930 | +error hint: | |
7931 | + | |
7932 | +CONTEXT: SQL statement "SELECT /*+SeqScan(t1)*/ t1.id FROM t1 WHERE t1.id = 1" | |
7933 | +PL/pgSQL function "inline_code_block" line 5 at SQL statement | |
7934 | +RESET client_min_messages; |
@@ -115,6 +115,24 @@ error hint: | ||
115 | 115 | -> Seq Scan on t2 |
116 | 116 | (5 rows) |
117 | 117 | |
118 | +EXPLAIN (COSTS false) /*+Set(enable_indexscan off)*/ | |
119 | + SELECT * FROM t1, t2 WHERE t1.id = t2.id; | |
120 | +LOG: pg_hint_plan: | |
121 | +used hint: | |
122 | +Set(enable_indexscan off) | |
123 | +not used hint: | |
124 | +duplication hint: | |
125 | +error hint: | |
126 | + | |
127 | + QUERY PLAN | |
128 | +------------------------------ | |
129 | + Hash Join | |
130 | + Hash Cond: (t1.id = t2.id) | |
131 | + -> Seq Scan on t1 | |
132 | + -> Hash | |
133 | + -> Seq Scan on t2 | |
134 | +(5 rows) | |
135 | + | |
118 | 136 | /*+ Set(enable_indexscan off) Set(enable_hashjoin off) */ |
119 | 137 | EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; |
120 | 138 | LOG: pg_hint_plan: |
@@ -7947,3 +7965,57 @@ error hint: | ||
7947 | 7965 | Filter: (val = 1) |
7948 | 7966 | (20 rows) |
7949 | 7967 | |
7968 | +-- search from hint table | |
7969 | +INSERT INTO hint_plan.hints VALUES ('EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;', '', 'SeqScan(t1)'); | |
7970 | +SET pg_hint_plan.lookup_hint_in_table = on; | |
7971 | +EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1; | |
7972 | +LOG: pg_hint_plan: | |
7973 | +used hint: | |
7974 | +SeqScan(t1) | |
7975 | +not used hint: | |
7976 | +duplication hint: | |
7977 | +error hint: | |
7978 | + | |
7979 | + QUERY PLAN | |
7980 | +-------------------- | |
7981 | + Seq Scan on t1 | |
7982 | + Filter: (id = 1) | |
7983 | +(2 rows) | |
7984 | + | |
7985 | +SET pg_hint_plan.lookup_hint_in_table = off; | |
7986 | +EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1; | |
7987 | + QUERY PLAN | |
7988 | +-------------------------------- | |
7989 | + Index Scan using t1_pkey on t1 | |
7990 | + Index Cond: (id = 1) | |
7991 | +(2 rows) | |
7992 | + | |
7993 | +TRUNCATE hint_plan.hints; | |
7994 | +VACUUM ANALYZE; | |
7995 | +-- plpgsql test | |
7996 | +EXPLAIN SELECT id FROM t1 WHERE t1.id = 1; | |
7997 | + QUERY PLAN | |
7998 | +----------------------------------------------------------------------- | |
7999 | + Index Only Scan using t1_pkey on t1 (cost=0.00..4.28 rows=1 width=4) | |
8000 | + Index Cond: (id = 1) | |
8001 | +(2 rows) | |
8002 | + | |
8003 | +SET client_min_messages = LOG; | |
8004 | +DO LANGUAGE plpgsql $$ | |
8005 | +DECLARE | |
8006 | + id integer; | |
8007 | +BEGIN | |
8008 | + SELECT /*+SeqScan(t1)*/ t1.id INTO id FROM t1 WHERE t1.id = 1; | |
8009 | + RETURN; | |
8010 | +END; | |
8011 | +$$; | |
8012 | +LOG: pg_hint_plan: | |
8013 | +used hint: | |
8014 | +SeqScan(t1) | |
8015 | +not used hint: | |
8016 | +duplication hint: | |
8017 | +error hint: | |
8018 | + | |
8019 | +CONTEXT: SQL statement "SELECT /*+SeqScan(t1)*/ t1.id FROM t1 WHERE t1.id = 1" | |
8020 | +PL/pgSQL function inline_code_block line 5 at SQL statement | |
8021 | +RESET client_min_messages; |
@@ -25,6 +25,8 @@ EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; | ||
25 | 25 | EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; |
26 | 26 | /*+Set(enable_indexscan off)*/ |
27 | 27 | EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; |
28 | +EXPLAIN (COSTS false) /*+Set(enable_indexscan off)*/ | |
29 | + SELECT * FROM t1, t2 WHERE t1.id = t2.id; | |
28 | 30 | /*+ Set(enable_indexscan off) Set(enable_hashjoin off) */ |
29 | 31 | EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; |
30 | 32 |
@@ -819,3 +821,25 @@ EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1; | ||
819 | 821 | EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1; |
820 | 822 | /*+ BitmapScan(p1 p1_.*val2.*)*/ |
821 | 823 | EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1; |
824 | + | |
825 | +-- search from hint table | |
826 | +INSERT INTO hint_plan.hints VALUES ('EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;', '', 'SeqScan(t1)'); | |
827 | +SET pg_hint_plan.lookup_hint_in_table = on; | |
828 | +EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1; | |
829 | +SET pg_hint_plan.lookup_hint_in_table = off; | |
830 | +EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1; | |
831 | +TRUNCATE hint_plan.hints; | |
832 | +VACUUM ANALYZE; | |
833 | + | |
834 | +-- plpgsql test | |
835 | +EXPLAIN SELECT id FROM t1 WHERE t1.id = 1; | |
836 | +SET client_min_messages = LOG; | |
837 | +DO LANGUAGE plpgsql $$ | |
838 | +DECLARE | |
839 | + id integer; | |
840 | +BEGIN | |
841 | + SELECT /*+SeqScan(t1)*/ t1.id INTO id FROM t1 WHERE t1.id = 1; | |
842 | + RETURN; | |
843 | +END; | |
844 | +$$; | |
845 | +RESET client_min_messages; |