Updated on 2024-08-20 GMT+08:00

Bitmap Scan Hints

Description

These hints generate a bitmap scan path by using the specified index on the target table. The path that meets the hint requirement is selected from the paths that can be generated by the optimizer.

Syntax

[no] bitmapscan([@queryblock] table [index_list])

Parameters

  • no indicates that the specified hint will not be used for a join.

Example

gaussdb=# explain(costs off)  select /*+ BitmapScan(t1 it1 it3)*/* from t1 where  (t1.c1 = 5 or t1.c2=6) or (t1.c3=3 or t1.c2=7);
                           QUERY PLAN                           
----------------------------------------------------------------
 Bitmap Heap Scan on t1
   Recheck Cond: ((c1 = 5) OR (c2 = 6) OR (c3 = 3) OR (c2 = 7))
   ->  BitmapOr
         ->  Bitmap Index Scan on it1
               Index Cond: (c1 = 5)
         ->  Bitmap Index Scan on it3
               Index Cond: (c2 = 6)
         ->  Bitmap Index Scan on it3
               Index Cond: (c3 = 3)
         ->  Bitmap Index Scan on it3
               Index Cond: (c2 = 7)
(11 rows)

The path that meets the bitmap scan hint is selected from the existing index paths. Because the index path construction space is large and the optimizer prunes the paths, if any index path is not generated, the path cannot be constructed.