1 Plantuner - enable planner hints
3 contrib/plantuner is a contribution module for PostgreSQL 8.4+, which enable
6 All work was done by Teodor Sigaev (teodor@sigaev.ru) and
7 Oleg Bartunov (oleg@sai.msu.su).
9 Sponsor: JFG Networks (www.jfg-networks.net)
12 It's very interesting to be able to control planner (provide hints), which is
13 currently impossible. This first version of plantuner provides a possibility to
14 hide specified indexes from PostgreSQL planner, so it will not use them.
16 There are many situation, when developer want to temporarily disable specific
17 index(es), without dropping them, or to instruct planner to use specific index.
20 * Get latest source of plantuner from CVS Repository
21 * gmake && gmake install && gmake installcheck
25 To enable the module you can either load shared library 'plantuner' in psql
26 session or specify 'shared_preload_libraries' option in postgresql.conf.
29 =# create table test(id int);
30 =# create index id_idx on test(id);
31 =# create index id_idx2 on test(id);
34 Column | Type | Modifiers
35 --------+---------+-----------
40 =# explain select id from test where id=1;
42 -----------------------------------------------------------------------
43 Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
44 Recheck Cond: (id = 1)
45 -> Bitmap Index Scan on id_idx2 (cost=0.00..4.34 rows=12 width=0)
48 =# set enable_seqscan=off;
49 =# set plantuner.forbid_index='id_idx2';
50 =# explain select id from test where id=1;
52 ----------------------------------------------------------------------
53 Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
54 Recheck Cond: (id = 1)
55 -> Bitmap Index Scan on id_idx (cost=0.00..4.34 rows=12 width=0)
58 =# set plantuner.forbid_index='id_idx2,id_idx';
59 =# explain select id from test where id=1;
61 -------------------------------------------------------------------------
62 Seq Scan on test (cost=10000000000.00..10000000040.00 rows=12 width=4)