1 Plantuner - enable planner hints
3 contrib/plantuner is a contribution module for PostgreSQL 8.4+, which
6 All work was done by Teodor Sigaev (teodor@sigaev.ru) and Oleg Bartunov
9 Sponsor: Nomao project (http://www.nomao.com)
13 Whether somebody think it's bad or not, but sometime it's very
14 interesting to be able to control planner (provide hints, which tells
15 optimizer to ignore its algorithm in part), which is currently
16 impossible in POstgreSQL. Oracle, for example, has over 120 hints, SQL
17 Server also provides hints.
19 This first version of plantuner provides a possibility to hide
20 specified indexes from PostgreSQL planner, so it will not use them.
22 There are many situation, when developer want to temporarily disable
23 specific index(es), without dropping them, or to instruct planner to
28 * Get latest source of plantuner from CVS Repository
29 * gmake && gmake install && gmake installcheck
33 To enable the module you can either load shared library 'plantuner' in
34 psql session or specify 'shared_preload_libraries' option in
37 =# create table test(id int);
38 =# create index id_idx on test(id);
39 =# create index id_idx2 on test(id);
42 Column | Type | Modifiers
43 --------+---------+-----------
48 =# explain select id from test where id=1;
50 -----------------------------------------------------------------------
51 Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
52 Recheck Cond: (id = 1)
53 -> Bitmap Index Scan on id_idx2 (cost=0.00..4.34 rows=12 width=0)
56 =# set enable_seqscan=off;
57 =# set plantuner.forbid_index='id_idx2';
58 =# explain select id from test where id=1;
60 ----------------------------------------------------------------------
61 Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
62 Recheck Cond: (id = 1)
63 -> Bitmap Index Scan on id_idx (cost=0.00..4.34 rows=12 width=0)
66 =# set plantuner.forbid_index='id_idx2,id_idx';
67 =# explain select id from test where id=1;
69 -------------------------------------------------------------------------
70 Seq Scan on test (cost=10000000000.00..10000000040.00 rows=12 width=4)