Bitmap Index
ELI5 — The Vibe Check
A bitmap index stores a bit array for each distinct value in a column. If a column has 3 possible values (red, green, blue), there are 3 bitmaps, each with one bit per row. Super efficient for low-cardinality columns like status, gender, or boolean flags. Oracle and PostgreSQL (at query time) use them.
Real Talk
A bitmap index represents each distinct value as a bit vector with one bit per table row. It's extremely space-efficient for low-cardinality columns and excels at combining multiple conditions using bitwise AND/OR operations. PostgreSQL creates bitmap indexes dynamically during query execution (bitmap heap scan) but doesn't support persistent bitmap indexes. Oracle and other databases offer them natively.
When You'll Hear This
"Bitmap indexes shine when combining multiple low-cardinality filters like status AND region AND type." / "PostgreSQL creates bitmap indexes on-the-fly during query execution — you don't need to create them explicitly."
Related Terms
B-Tree Index
A B-Tree index is the default index type that most databases create when you say CREATE INDEX.
Hash Index
A hash index uses a hash function to map values directly to locations, making equality lookups insanely fast.
Index
A database index is like the index in the back of a book. Without it, the database reads every single row to find what you want.
Query Optimization
Query optimization is the art of making slow database queries fast. Add an index here, rewrite that subquery as a JOIN, fetch only the columns you need.