pg_hint_plan

An extension which enables embedding of explicit planner hints in SQL statements

pg_hint_plan is an extension provided by NTT which enables explicit planner hints to be embedded in a specially formatted comment block preceding the actual SQL query. Alternatively, queries with hints can be stored in a special configuration table.

Note that while documentation for pg_hint_plan is available in English, the Japanese original tends to be more up-to-date (see links below).

Release history

  Date 12 11 10 9.6 9.5 9.4 9.3 9.2 9.1
1.3.5 2020-02 x x x            
1.3.4 2019-01   x              
1.3.3 2019-01   x x            
1.3.2 2018-11   x x            
1.3.1 2018-06     x            
1.3.0 2017-10     x            
1.2.6 2020-02       x          
1.2.5 2019-01       x          
1.2.4 2018-11       x          
1.2.3 2018-06       x          
1.2.2 2017-07       x          
1.2.1 2017-05       x          
1.2.0 2017-02       x          
1.1.9 2020-02         x x      
1.1.8 2019-01         x x      
1.1.7 2018-11         x x      
1.1.6 2018-06         x x x    
1.1.5 2017-07         x x x    
1.1.4 2017-05           x x    
1.1.3 2014-12       x   x x x  
1.1.2 2014-12           x x x  
1.1.1 2014-09             x x x
1.0.2 2014-12                 x

Examples

  /*+
      HashJoin(a b)
      SeqScan(a)
    */
    SELECT *
      FROM pgbench_branches b
      JOIN pgbench_accounts a ON b.bid = a.bid
     ORDER BY a.aid;

The above example will cause the planner to use the results of a seq scan on table a to be combined with table b as a hash join.

Categories

Extension, Performance