> [!NOTE] Bitmap And / Bitmap Or
> <table>
> <tr>
> <td width="25%"><img src="assets/ex_bitmapandbitmapor.png"></td>
> <td>Combines multiple TID bitmaps using bitwise logic.</td>
> </tr>
> </table>
>
> ```sql
> -- Combining results from two separate indexes
> SET enable_seqscan = off;
>
> EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE)
> SELECT * FROM animals
> WHERE species_id = 1 OR species_id = 5;
> ```
>
> 
>
> ```text
> Bitmap Heap Scan on public.animals (cost=56.37..190.37 rows=3600 width=27) (actual time=0.092..0.508 rows=4000 loops=1)
> Output: id, name, species_id, created_at
> Recheck Cond: ((animals.species_id = 1) OR (animals.species_id = 5))
> Heap Blocks: exact=74
> Buffers: shared hit=80
> -> BitmapOr (cost=56.37..56.37 rows=4000 width=0) (actual time=0.078..0.078 rows=0 loops=1)
> Buffers: shared hit=6
> -> Bitmap Index Scan on idx_animals_species_id (cost=0.00..27.29 rows=2000 width=0) (actual time=0.044..0.044 rows=2000 loops=1)
> Index Cond: (animals.species_id = 1)
> Buffers: shared hit=3
> -> Bitmap Index Scan on idx_animals_species_id (cost=0.00..27.29 rows=2000 width=0) (actual time=0.034..0.034 rows=2000 loops=1)
> Index Cond: (animals.species_id = 5)
> Buffers: shared hit=3
> Planning:
> Buffers: shared hit=84
> Planning Time: 0.364 ms
> Execution Time: 0.655 ms
> ```
>
> 
>
> <table>
> <tr>
> <td rowspan="2" width="25%"><img src="assets/ex_bmp_and.svg" style="width: 48%;"><img src="assets/ex_bmp_or.svg" style="width: 48%;"></td>
> <td><b>Performance</b></td><td>Combines index-produced TID bitmaps before visiting the heap, avoiding unnecessary page fetches.</td>
> </tr>
> <tr><td><b>Cost</b></td><td><code>input bitmap costs + bitmap combination + matching heap pages</code></td></tr>
> </table>