From ee271764934e5b1a8758d040f64a6a9b645f3443 Mon Sep 17 00:00:00 2001 From: Shigeru Hanada Date: Mon, 16 Apr 2012 17:54:48 +0900 Subject: [PATCH] =?utf8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=81=AE?= =?utf8?q?=E5=BC=B7=E8=AA=BF=E8=A1=A8=E7=A4=BA=E3=81=AB=E3=82=B9=E3=82=BF?= =?utf8?q?=E3=82=A4=E3=83=AB=E3=82=B7=E3=83=BC=E3=83=88=E3=82=92=E4=BD=BF?= =?utf8?q?=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 従来はタグが使用されていたので、標準のスタイルシートファイルに span.strongスタイル(ボールド+下線)を追加した。 --- doc/pg_hint_plan-ja.html | 48 ++++++++++++++++++++++++------------------------ doc/style.css | 5 +++++ 2 files changed, 29 insertions(+), 24 deletions(-) mode change 100644 => 100755 doc/style.css diff --git a/doc/pg_hint_plan-ja.html b/doc/pg_hint_plan-ja.html index 0fb7328..439fba8 100644 --- a/doc/pg_hint_plan-ja.html +++ b/doc/pg_hint_plan-ja.html @@ -94,8 +94,8 @@ postgres=#

以下に示した具体例について説明します。この例では、HashJoin(a b)とSeqScan(a)がヒントと見なされ、IndexScan(a)とMergeJoin(a b)は無視されています。

 postgres=# /*
-postgres*#    HashJoin(a b)
-postgres*#    SeqScan(a)
+postgres*#    HashJoin(a b)
+postgres*#    SeqScan(a)
 postgres*#  */
 postgres-# /* IndexScan(a) */
 postgres-# EXPLAIN SELECT /* MergeJoin(a b) */ *
@@ -106,9 +106,9 @@ postgres-#   ORDER BY a.aid;
 ---------------------------------------------------------------------------------------
  Sort  (cost=31465.84..31715.84 rows=100000 width=197)
    Sort Key: a.aid
-   ->  Hash Join  (cost=1.02..4016.02 rows=100000 width=197)
+   ->  Hash Join  (cost=1.02..4016.02 rows=100000 width=197)
          Hash Cond: (a.bid = b.bid)
-         ->  Seq Scan on pgbench_accounts a  (cost=0.00..2640.00 rows=100000 width=97)
+         ->  Seq Scan on pgbench_accounts a  (cost=0.00..2640.00 rows=100000 width=97)
          ->  Hash  (cost=1.01..1.01 rows=1 width=100)
                ->  Seq Scan on pgbench_branches b  (cost=0.00..1.01 rows=1 width=100)
 (7 rows)
@@ -124,13 +124,13 @@ postgres=# 
2つ目のSQL文では、各テーブルにptやstという別名をつけているため、実行計画作成時にヒントで指定した通りにMerge Joinを選択しています。

-postgres=# /* MergeJoin(t1 t1)*/
+postgres=# /* MergeJoin(t1 t1)*/
 postgres-# EXPLAIN SELECT * FROM s1.t1
 postgres-# JOIN public.t1 ON (s1.t1.id=public.t1.id);
 INFO:  hint syntax error at or near "t1 t1)"
-DETAIL:  relation name "t1" is ambiguous
+DETAIL:  relation name "t1" is ambiguous
 INFO:  hint syntax error at or near "t1 t1)"
-DETAIL:  relation name "t1" is ambiguous
+DETAIL:  relation name "t1" is ambiguous
                              QUERY PLAN
 --------------------------------------------------------------------
  Hash Join  (cost=270.00..323.05 rows=1230 width=44)
@@ -140,12 +140,12 @@ INFO:  hint syntax error at or near "t1 t1)"
          ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
 (5 rows)
 
-postgres=# /* MergeJoin(pt st) */
+postgres=# /* MergeJoin(pt st) */
 postgres-# EXPLAIN SELECT * FROM s1.t1 st
 postgres-# JOIN public.t1 pt ON (st.id=pt.id);
                                     QUERY PLAN
 ----------------------------------------------------------------------------------
- Merge Join  (cost=0.00..421.33 rows=1230 width=44)
+ Merge Join  (cost=0.00..421.33 rows=1230 width=44)
    Merge Cond: (st.id = pt.id)
    ->  Index Scan using t1_id_idx on t1 st  (cost=0.00..62.70 rows=1230 width=36)
    ->  Index Scan using t1_pkey on t1 pt  (cost=0.00..318.25 rows=10000 width=8)(4 rows)
@@ -155,13 +155,13 @@ postgres=#

インデックスを対象にする場合は、インデックス名で指定してください。なお、インデックス名のみを対象とするヒントはありません。

以下に示した具体例について説明します。
この例では、IndexScanヒントに対してt1テーブルの他にt1_valインデックスを指定したため、実行計画作成時にt1_valインデックスを用いたIndex Scanを選択しています。

-postgres=# /* IndexScan(t1 t1_val) */
+postgres=# /* IndexScan(t1 t1_val) */
 postgres-# EXPLAIN SELECT * FROM t1
 postgres-#   WHERE id < 5
 postgres-#     AND val < 3;
                             QUERY PLAN
 -------------------------------------------------------------------
- Index Scan using t1_val on t1  (cost=0.00..190.19 rows=1 width=8)
+ Index Scan using t1_val on t1  (cost=0.00..190.19 rows=1 width=8)
    Index Cond: (val < 3)
    Filter: (id < 5)
 (3 rows)
@@ -179,16 +179,16 @@ postgres=#
 

以下に示した具体例について説明します。
1つ目のSQL文では、aテーブルにIndex Scanを選択させるヒントを用いたため、実行計画作成時にaテーブルに対してIndex Scanを選択しています。
2つ目のSQL文では、aテーブルにIndex Scan以外を選択させるヒントを用いたため、実行計画作成時にaテーブルに対してIndex Scan以外のスキャン方式であるSeq Scanを選択しています。

-
postgres=# /* IndexScan(a) */
+
postgres=# /* IndexScan(a) */
 postgres-# EXPLAIN SELECT *
 postgres-#    FROM pgbench_accounts a
 postgres-#   ORDER BY aid;
                                                QUERY PLAN
 ---------------------------------------------------------------------------------------------------------
- Index Scan using pgbench_accounts_pkey on pgbench_accounts a  (cost=0.00..4247.26 rows=100000 width=97)
+ Index Scan using pgbench_accounts_pkey on pgbench_accounts a  (cost=0.00..4247.26 rows=100000 width=97)
 (1 row)
 
-postgres=# /* NoIndexScan(a) */
+postgres=# /* NoIndexScan(a) */
 postgres-# EXPLAIN SELECT *
 postgres-#    FROM pgbench_accounts a
 postgres-#   ORDER BY aid;
@@ -196,7 +196,7 @@ postgres-#   ORDER BY aid;
 ---------------------------------------------------------------------------------
  Sort  (cost=21885.82..22135.82 rows=100000 width=97)
    Sort Key: aid
-   ->  Seq Scan on pgbench_accounts a  (cost=0.00..2640.00 rows=100000 width=97)
+   ->  Seq Scan on pgbench_accounts a  (cost=0.00..2640.00 rows=100000 width=97)
 (3 rows)
 
 postgres=#
@@ -210,14 +210,14 @@ postgres=#
 2つ目のSQL文では、aテーブルとbテーブルの結合にMerge Join以外を選択させるヒントを用いたため、実行計画作成時にMerge Join以外の結合方式であるNested Loopを選択しています。

 postgres=# /*
-postgres*#   MergeJoin(b a)
+postgres*#   MergeJoin(b a)
 postgres*#  */
 postgres-# EXPLAIN SELECT *
 postgres-#    FROM pgbench_branches b
 postgres-#    JOIN pgbench_accounts a ON b.bid = a.bid;
                                          QUERY PLAN
 ---------------------------------------------------------------------------------------------
- Merge Join  (cost=21886.84..23636.85 rows=100000 width=197)
+ Merge Join  (cost=21886.84..23636.85 rows=100000 width=197)
    Merge Cond: (b.bid = a.bid)
    ->  Sort  (cost=1.02..1.02 rows=1 width=100)
          Sort Key: b.bid
@@ -229,14 +229,14 @@ postgres-#    JOIN pgbench_accounts a ON b.bid = a.bid;
 (9 rows)
 
 postgres=# /*
-postgres*#   NoMergeJoin(b a)
+postgres*#   NoMergeJoin(b a)
 postgres*#  */
 postgres-# EXPLAIN SELECT *
 postgres-#    FROM pgbench_branches b
 postgres-#    JOIN pgbench_accounts a ON b.bid = a.bid;
                                    QUERY PLAN
 ---------------------------------------------------------------------------------
- Nested Loop  (cost=0.00..3891.01 rows=100000 width=197)
+ Nested Loop  (cost=0.00..3891.01 rows=100000 width=197)
    Join Filter: (b.bid = a.bid)
    ->  Seq Scan on pgbench_branches b  (cost=0.00..1.01 rows=1 width=100)
    ->  Seq Scan on pgbench_accounts a  (cost=0.00..2640.00 rows=100000 width=97)
@@ -249,7 +249,7 @@ postgres=#

以下に示した具体例について説明します。
この例では、bテーブルとaテーブルを結合させた後、この結合テーブルとtテーブルを結合させるヒントを用いたため、実行計画作成時にヒントで指定したテーブル順でテーブル結合を選択しています。

postgres=# /*
-postgres*#  Leading(b a t)
+postgres*#  Leading(b a t)
 postgres*#  */
 postgres-# EXPLAIN SELECT *
 postgres-#    FROM pgbench_branches b
@@ -258,9 +258,9 @@ postgres-#    JOIN pgbench_tellers t ON b.bid = t.bid;
                                                   QUERY PLAN
 --------------------------------------------------------------------------------------------------------------
  Hash Join  (cost=1.23..15399.49 rows=1000000 width=297)
-   Hash Cond: (b.bid = t.bid)
+   Hash Cond: (b.bid = t.bid)
    ->  Nested Loop  (cost=0.00..3898.27 rows=100000 width=197)
-         Join Filter: (b.bid = a.bid)
+         Join Filter: (b.bid = a.bid)
          ->  Index Scan using pgbench_branches_pkey on pgbench_branches b  (cost=0.00..8.27 rows=1 width=100)
          ->  Seq Scan on pgbench_accounts a  (cost=0.00..2640.00 rows=100000 width=97)
    ->  Hash  (cost=1.10..1.10 rows=10 width=100)
@@ -284,9 +284,9 @@ postgres-#    JOIN pgbench_accounts a ON b.bid = a.bid
 postgres-#    JOIN pgbench_tellers t ON b.bid = t.bid;
                                          QUERY PLAN
 ---------------------------------------------------------------------------------------------
- Merge Join  (cost=21888.11..37138.29 rows=1000000 width=297)
+ Merge Join  (cost=21888.11..37138.29 rows=1000000 width=297)
    Merge Cond: (b.bid = a.bid)
-   ->  Merge Join  (cost=2.29..2.44 rows=10 width=200)
+   ->  Merge Join  (cost=2.29..2.44 rows=10 width=200)
          Merge Cond: (b.bid = t.bid)
          ->  Sort  (cost=1.02..1.02 rows=1 width=100)
                Sort Key: b.bid
diff --git a/doc/style.css b/doc/style.css
old mode 100644
new mode 100755
index d832887..54c34ca
--- a/doc/style.css
+++ b/doc/style.css
@@ -83,3 +83,8 @@ p.footer {
 span.param {
 	color: #0000cd;
 }
+
+span.strong {
+	font-weight: bold;
+	text-decoration: underline;
+}
\ No newline at end of file
-- 
2.11.0