When does PostgreSQL automatically create a Bitmap index for a table?
I saw the following examples from PostgreSQL' documentation, and wonder why changing the value in WHERE could make a difference? Thanks.
EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 7000;
QUERY PLAN
------------------------------------------------------------
Seq Scan on tenk1 (cost=0.00..483.00 rows=7001 width=244)
Filter: (unique1 < 7000)
and
EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 100;
QUERY PLAN
------------------------------------------------------------------------------
Bitmap Heap Scan on tenk1 (cost=5.07..229.20 rows=101 width=244)
Recheck Cond: (unique1 < 100)
-> Bitmap Index Scan on tenk1_unique1 (cost=0.00..5.04 rows=101
width=0)
Index Cond: (unique1 < 100)
Postgres does not have "Bitmap Indexes".
What you see there is an "index scan" that uses a bitmap while scanning the index.
Tom Lane's answer on the mailing list explains it quite well:
See also this question https://dba.stackexchange.com/questions/119386 for a more detailed explanation.