# Bitmap And / Bitmap Or (The Map Combiners) ![[assets/ex_bitmapandbitmapor.png|256]] > [!NOTE] > **Metaphor: Combining Map Overlays.** If two different patrons order the same dish, the server takes two transparent map overlays (the Bitmaps) and stacks them. Where the dots overlap (AND) or combine (OR) is where the server needs to go. ### How it Works These internal nodes combine two or more **TIDBitmaps** using logical bitwise operations. This is one of the most powerful features of the relational model: turning complex search logic into simple binary arithmetic. ### Physical Implementation - **Bitwise Intersection (AND)**: Performs a `&` operation on the bitsets. Only bits present in BOTH input bitmaps remain. - **Bitwise Union (OR)**: Performs a `|` operation on the bitsets. Bits present in EITHER input bitmap remain. - **Efficiency**: Because bitsets are extremely compact (1 bit per 8KB page), the CPU can process millions of rows in microseconds using standard registers. This allows Postgres to combine multiple un-related indexes (e.g., searching for animals that are `Species: Capybara` AND `Diet: Herbivore`) without needing a specialized "multi-column" index. - **Operates on**: [[Structures/Index|Index]] - **Factor**: `cpu_operator_cost` - **Workloads**: - [[Workloads/LWLock/Buffers/SharedTidBitmap|LWLock: SharedTidBitmap]] - [[Workloads/LWLock/Buffers/BufferContent|LWLock: BufferContent]] - [[Workloads/IPC/Parallel/ParallelBitmapScan|IPC: ParallelBitmapScan]]