OSDN Git Service

Added a notice in the manual.
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Tue, 10 Oct 2017 03:17:58 +0000 (12:17 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Tue, 10 Oct 2017 03:35:22 +0000 (12:35 +0900)
Added an item that explains about letter case handling of object names
in hints.

doc/pg_hint_plan-ja.html
doc/pg_hint_plan.html

index 665d8c4..76272e2 100755 (executable)
@@ -498,7 +498,9 @@ postgres$# END;
 postgres$# $$ LANGUAGE plpgsql;
 </pre>
 </dd>
-<dt><h3>オブジェクト名の引用符付け</h3></dt>
+<dt><h3>ヒント句内のオブジェクト名の文字ケース</h3></dt>
+<dd>PostgreSQL は引用符で囲われないオブジェクト名を文字ケースを無視して扱いますが、pg_hint_plan は指定されたオブジェクト名の文字ケースはそのまま PostgreSQL の内部表現と比較します。つまり、ヒント句で TBL と指定した場合、データベース上で "TBL" と定義したもののみと合致し, TBL, tbl, Tbl など引用符で囲われないオブジェクト名とは合致しません。</dd>
+<dt><h3>ヒント句内のオブジェクト名の引用符付け</h3></dt>
 <dd>ヒントに記述するオブジェクト名や別名が括弧((、)のいずれか)、二重引用符(")、空白(スペース、タブ、改行のいずれか)を含む場合は、通常のSQL文で使う場合と同じように二重引用符(")で囲んでください。二重引用符を含むオブジェクト名は、全体を二重引用符で括ったうえで、内部に含む二重引用符を二重引用符でエスケープしてください(例: 「quoted"table"name」→「"quoted""table""name"」)。</dd>
 <dt><h3>同一名称テーブルの区別</h3></dt>
 <dd>スキーマ違いや同一テーブルの複数回使用などでクエリ中に同一名称のテーブルが複数回出現する場合は、テーブルに別名をつけてそれぞれのテーブルを区別してください。以下の例の1つ目のSQL文では、HashJoin(t1 t1)をヒントに指定したとき、ヒント句対象のオブジェクトが特定できずにエラーになっています。2つ目のSQL文では、各テーブルにptやstという別名をつけているため、実行計画作成時にヒントで指定した通りにHash Joinを選択しています。</p>
@@ -620,10 +622,6 @@ postgres=#
 <dd>NoIndexScanヒント句を指定した場合は、Index ScanだけでなくIndex Only Scanも選択されません。</dd>
 </dl>
 
-<dt><h3>並列実行ヒントとスキャン方式ヒントの関係について</h3></dt>
-<dd>スキャン方式ヒントは並列実行の部分パスを生成する際にも影響を与えます。今のところ並列実行の部分パスはシーケンシャルスキャンとなるため、シーケンシャルスキャンを禁止すると同じオブジェクトへの並列実行ヒントが無効化されます。</dd>
-</dl>
-
 <dt><h3>UNION に対する並列実行ヒント</h3></dt>
 <dd>UNIONは直下のサブクエリが全て並列実行可能な場合にだけ並列実行を行います。一方ですべてのサブクエリが並列実行可能な場合は、そのうちの一つで並列実行を強制するとコスト比較の結果UNION全体が並列実行されることになります。ただし並列実行ヒントによる並列実行の禁止を行った場合はそのスキャンは並列実行不可となります。
 </dd>
index ff4ac9c..6bb01df 100755 (executable)
@@ -319,6 +319,10 @@ postgres$# $$ LANGUAGE plpgsql;
 </pre>
 </dd>
 
+<h3>Letter case in a hinted object</h3>
+<dd>Unlike the way PostgreSQL handles object names, pg_hint_plan compares bare object names in hints against the database internal object names in case sensitive way. Therefore an object name TBL in a hint matches only "TBL" in database and does not match any unquoted names like TBL, tbl or Tbl.
+</dd>
+
 <h3>Escaping special chacaters in object names</h3>
 <dd>The objects as the hint parameter should be enclosed by double quotes if they includes parentheses, double quotes and white spaces. The escaping rule is the same as PostgreSQL.
 </dd>
@@ -372,12 +376,6 @@ hint affect all the inheritance. Hints simultaneously point directly
 to children are not in effect.
 </dd>
 
-<h3>Inheritance tables</h3>
-<dd>Hints can point only the parent of an inheritance tables and the
-hint affect all the inheritance. Hints simultaneously point directly
-to children are not in effect.
-</dd>
-
 <h3>Hinting on multistatements</h3>
 <dd>One multistatement can have exactly one hint comment and the hints affects all of the individual statement in the multistatement. Notice that the seemingly multistatement on the interactive interface of psql is internally a sequence of single statements so hints affects only on the statement just following.</dd>
 
@@ -436,17 +434,12 @@ IN (SELECT ... {<b>LIMIT | OFFSET</b> ...} ...)
 <h3>Behavior of NoIndexScan</h3>
 <dd>NoIndexScan hint involes NoIndexOnlyScan.</dd>
 
-<h3>Parallel vs Scan hints</h3>
-<dd>Scan hints also affect building partial paths. Since parallel
-paths are currently consists of partial sequential scans, inhibiting
-seqscan beats parallel hint on the same relation.</dd>
-
 <h3>Parallel hint and UNION</h3>
 <dd>A UNION can run in parallel only when all underlying subqueries
 are parallel-safe. Conversely enforcing parallel on any of
 the subqueries let a parallel-executable UNION run in
-parallel. Meanwhile, a parallel hint with zero workers makes a scan
-parallel-inexecutable.</dd>
+parallel. Meanwhile, a parallel hint with zero workers hinhibits a scan
+from executed in parallel.</dd>
 
 <h3>Setting pg_hint_plan parameters by Set hints</h3>
 <dd><p>pg_hint_plan paramters change the behavior of itself so some parameters doesn't work as expected.</p>