pg_hint_plan for PostgreSQL 10 (1.3.6) | 2020-08-05 17:26 |
pg_hint_plan for PostgreSQL 11 (1.3.7) | 2020-10-30 09:07 |
pg_hint_plan for PostgreSQL 12 (1.3.7) | 2020-10-30 09:49 |
pg_hint_plan for PostgreSQL 13 (1.3.7) | 2020-10-30 09:50 |
pg_hint_plan for PostgreSQL 9.1 (1.0.2) | 2014-12-19 16:35 |
pg_hint_plan for PostgreSQL 9.2 (1.1.3) | 2014-12-22 21:25 |
pg_hint_plan for PostgreSQL 9.3 (1.1.6) | 2018-06-08 15:49 |
pg_hint_plan for PostgreSQL 9.4 (1.1.9) | 2020-02-21 10:01 |
pg_hint_plan for PostgreSQL 9.5 (1.1.9) | 2020-02-21 10:48 |
pg_hint_plan for PostgreSQL 9.6 (1.2.7) | 2020-08-05 17:27 |
Pg_hint_plan tweaks planner decisions with user's hints. PostgreSQL executes queries using cost-based optimizer, and sometimes fails to choose most efficient execution plan for technical limitations.
In such cases, pg_hint_plan helps users to guide the planner to choose the plans they want by putting some instructions - call them hints - in the comments prefixed to the SQL statement body. No need to rewrite statement itself nor change some GUC parameters elsewhere.
Pg_hint_plan's major Functional limitations below.
pg_hint_planは、コメント形式でSQLにヒント情報を記述することを可能とします。
SQLにヒントを記述することで、SQL文そのものややGUCパラメータを変えることなく実行計画を制御することが可能になります。
PostgreSQLはコストベースオプティマイザを採用しています。 オプティマイザは可能な限りよい実行計画を作成使用としますが、カラム間の相関関係などは考慮しないため、 複雑なクエリでは常に最適なプランが選択されるとは限りません。
pg_hint_planを用いると、ヒントを記述したブロックコメントをSQL文の前に加えることで、 SQL文やGUCパラメータを変更することなく実行計画を制御することができます。
pg_hint_planにはいくつかの機能制限があります。主なものは以下の通り。
- /*+
- HashJoin(a b)
- SeqScan(a)
- */
- EXPLAIN SELECT *
- FROM pgbench_branches b
- JOIN pgbench_accounts a ON b.bid = a.bid
- ORDER BY a.aid;
- QUERY PLAN
- ---------------------------------------------------------------------------------------
- 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 Cond: (a.bid = b.bid)
- -> 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)
pg_hint_plan for PostgreSQL 10 (1.3.6) | 2020-08-05 17:26 |
pg_hint_plan for PostgreSQL 11 (1.3.7) | 2020-10-30 09:07 |
pg_hint_plan for PostgreSQL 12 (1.3.7) | 2020-10-30 09:49 |
pg_hint_plan for PostgreSQL 13 (1.3.7) | 2020-10-30 09:50 |
pg_hint_plan for PostgreSQL 9.1 (1.0.2) | 2014-12-19 16:35 |
pg_hint_plan for PostgreSQL 9.2 (1.1.3) | 2014-12-22 21:25 |
pg_hint_plan for PostgreSQL 9.3 (1.1.6) | 2018-06-08 15:49 |
pg_hint_plan for PostgreSQL 9.4 (1.1.9) | 2020-02-21 10:01 |
pg_hint_plan for PostgreSQL 9.5 (1.1.9) | 2020-02-21 10:48 |
pg_hint_plan for PostgreSQL 9.6 (1.2.7) | 2020-08-05 17:27 |
add rewrite to pg_hint_plan | 2023-01-31 18:20 |
Hi Team, pg_hint_plan is cool. thanks a lot. how much work is it to add/extend query rewrite to it please? thanks a... | (未割り当て) |
binary for version 14.2 | 2023-01-31 18:14 |
Please provide pg_hint_plan binary for PG version 14.2 . thanks | (未割り当て) |
Hints appear to be ignored when PostgreSQL chooses a generic plan when executed from JDBC PreparedStatements. | 2022-12-19 14:15 |
Hints appear to be ignored when PostgreSQL chooses a generic plan when executed from JDBC PreparedStatements. Check a... | (未割り当て) |
Crash from illegal parallel bitmap scan plan in REL10_1_3_3 when index name is incorrect | 2019-06-24 23:52 |
Query crashes with the following stack using pg_hint_plan with REL10_1_3_3 when an incorrect index name is supplied d... | (未割り当て) |
undefined symbol: RINFO_IS_PUSHED_DOWN | 2018-09-18 23:43 |
postgres=# load 'pg_hint_plan'; ERROR: could not load library "/usr/pgsql-10/lib/pg_hint_plan.so": /usr/pg... | (未割り当て) |