{"Entry":{"collection":"plan","key":"bitmapand","name":"BitmapAnd","aliases":["BitmapAnd","T_BitmapAnd"],"metadata":{"aliases":["BitmapAnd","T_BitmapAnd"],"category":"Bitmap","content_hash":"6423b728057b60c165593b809d228f82bbf02a433dcc1d69ba1105867136eb95","imported_at":"2026-09-30T00:40:44.02165+08:00","name":"BitmapAnd","name_zh":"BitmapAnd","slug":"bitmapand","summary":"Intersects bitmaps produced by its child plans."}},"Definition":{"Collection":"plan","Key":"bitmapand","SourceDatabase":"center","Version":"18","SourceTable":"plan_node","SourceKey":"bitmapand","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"initializer":"ExecInitBitmapAnd","memory_mechanism":"unclassified","node_tag":"T_BitmapAnd","parallel_callbacks":[],"partial_modes":[],"strategies":[],"text_names":["BitmapAnd"]},"comparison_hash":"ffac2f4c3c78a9e2f88eb2c2de755f5a69e40f1ac6d7e9bcb4ed08615c9cb803","description":["Intersects bitmaps produced by its child plans."],"evidence_kind":"source and documentation","explain_names":["BitmapAnd"],"explain_prefixes":["Parallel","Async"],"facts":[{"label":"Core node tag","value":"T_BitmapAnd"},{"label":"Structured EXPLAIN Node Type","value":"BitmapAnd"},{"label":"Inputs","value":"Bitmap-producing child plans"},{"label":"Output","value":"Tuple-location bitmap, not a tuple stream"},{"label":"Executor initializer","value":"ExecInitBitmapAnd"},{"label":"Memory mechanism","value":"unclassified"}],"memory":{"description":"This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeBitmapAnd.c","path":"src/backend/executor/nodeBitmapAnd.c","sha256":"ec359e3996322cd5f16aab61f23a38e26dae336bbcea4db735a6a70e0ecc89dd","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"unclassified","source_notes":[]},"node_tag":"T_BitmapAnd","parallel_callbacks":[],"partial_modes":[],"related":[{"label":"EXPLAIN","url":"/wiki/sql/explain/?v=18"},{"label":"Using EXPLAIN","url":"/docs/18/using-explain.html"},{"label":"Parallel plans","url":"/docs/18/parallel-plans.html"}],"release":{"channel":"stable","label":"18.6","major":"18","ref":"PostgreSQL 18.6 source archive","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_snapshot_utc":"","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},"runtime_verified":false,"sections":[{"paragraphs":["Structured formats use the Node Type above. Text-format spellings can also include operation, strategy, join type, scan direction or aggregation-stage attributes.","Text names recorded by this source: BitmapAnd.","Parallel-aware and parallel-safe are different plan properties. A node running inside a parallel worker is not necessarily a parallel-aware node."],"title":"EXPLAIN names and attributes"},{"paragraphs":["This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider."],"title":"Memory and temporary storage"},{"paragraphs":["The source callbacks below can coordinate execution or collect worker instrumentation. Their presence is not a blanket claim that this node supports a shared parallel scan or shared state.","Callbacks in this build: none extracted from this node implementation."],"title":"Parallel execution and instrumentation"},{"paragraphs":["BitmapAnd and BitmapOr nodes always report their actual row counts as zero, due to implementation limitations."],"title":"Same-version manual discussion"},{"blocks":[{"code":"EXPLAIN SELECT * FROM tenk1 WHERE unique1 \u003c 100 AND unique2 \u003e 9000;\n\n                                     QUERY PLAN\n-------------------------------------------------------------------------------------\n Bitmap Heap Scan on tenk1  (cost=25.07..60.11 rows=10 width=244)\n   Recheck Cond: ((unique1 \u003c 100) AND (unique2 \u003e 9000))\n   -\u003e  BitmapAnd  (cost=25.07..25.07 rows=10 width=0)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..5.04 rows=100 width=0)\n               Index Cond: (unique1 \u003c 100)\n         -\u003e  Bitmap Index Scan on tenk1_unique2  (cost=0.00..19.78 rows=999 width=0)\n               Index Cond: (unique2 \u003e 9000)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","If there are separate indexes on several of the columns referenced in WHERE , the planner might choose to use an AND or OR combination of the indexes:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN (ANALYZE, BUFFERS OFF) SELECT * FROM tenk1 WHERE unique1 \u003c 100 AND unique2 \u003e 9000;\n\n                                                           QUERY PLAN\n---------------------------------------------------------------------------------------------------------------------------------\n Bitmap Heap Scan on tenk1  (cost=25.07..60.11 rows=10 width=244) (actual time=0.105..0.114 rows=10.00 loops=1)\n   Recheck Cond: ((unique1 \u003c 100) AND (unique2 \u003e 9000))\n   Heap Blocks: exact=10\n   -\u003e  BitmapAnd  (cost=25.07..25.07 rows=10 width=0) (actual time=0.100..0.101 rows=0.00 loops=1)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..5.04 rows=100 width=0) (actual time=0.027..0.027 rows=100.00 loops=1)\n               Index Cond: (unique1 \u003c 100)\n               Index Searches: 1\n         -\u003e  Bitmap Index Scan on tenk1_unique2  (cost=0.00..19.78 rows=999 width=0) (actual time=0.070..0.070 rows=999.00 loops=1)\n               Index Cond: (unique2 \u003e 9000)\n               Index Searches: 1\n Planning Time: 0.162 ms\n Execution Time: 0.143 ms","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","EXPLAIN has a BUFFERS option which provides additional detail about I/O operations performed during the planning and execution of the given query. The buffer numbers displayed show the count of the non-distinct buffers hit, read, dirtied, and written for the given node and all of its child nodes. The ANALYZE option implicitly enables the BUFFERS option. If this is undesired, BUFFERS may be explicitly disabled:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-ANALYZE"}}],"title":"Examples from this manual build"},{"paragraphs":["NOTES BitmapAnd nodes don't make use of their left and right subtrees, rather they maintain a list of subplans, much like Append nodes. The logic is much simpler than Append, however, since we needn't cope with forward/backward execution.","call ExecInitNode on each of the plans to be executed and save the results into the array \"bitmapplanstates\".","BitmapAnd plans don't have expression contexts because they never call ExecQual or ExecProject. They don't need any tuple slots either.","If at any stage we have a completely empty bitmap, we can fall out without evaluating the remaining subplans, since ANDing them can no longer change the result. (Note: the fact that indxpath.c orders the subplans by selectivity should make this case more likely to occur.)","ExecReScan doesn't know about my subplans, so I have to do changed-parameter signaling myself."],"title":"Executor implementation notes"},{"code":"case T_BitmapAnd:\n\t\t\tpname = sname = \"BitmapAnd\";\n\t\t\tbreak;","title":"EXPLAIN identity in core source"}],"source_inventory":{"executor":"src/backend/executor/execProcnode.c","explain":"src/backend/commands/explain.c","implementation":"src/backend/executor/nodeBitmapAnd.c"},"sources":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/commands/explain.c:1415","line":1415,"path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/execProcnode.c:196","line":196,"path":"src/backend/executor/execProcnode.c","sha256":"f8a06a3f539077249b20664b2812433db6d7bd12b2c0ca633525db43d06f112a","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeBitmapAnd.c","path":"src/backend/executor/nodeBitmapAnd.c","sha256":"ec359e3996322cd5f16aab61f23a38e26dae336bbcea4db735a6a70e0ecc89dd","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/include/nodes/plannodes.h","path":"src/include/nodes/plannodes.h","sha256":"52422b327a8049fbbb20d8b96008a0fc0a6fafa60f7eff3c695d5b2e83830120","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-CAVEATS"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-ANALYZE"}],"strategies":[],"tables":[{"columns":[{"key":"label","label":"Text-format label"},{"key":"identity","label":"Structured node identity"}],"key":"explain-labels","rows":[{"identity":"BitmapAnd","label":"BitmapAnd"}],"title":"EXPLAIN labels in this source build"}]},"ManualEvidence":{"release":{"channel":"stable","label":"18.6","major":"18","ref":"PostgreSQL 18.6 source archive","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_snapshot_utc":"","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},"sources":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/commands/explain.c:1415","line":1415,"path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/execProcnode.c:196","line":196,"path":"src/backend/executor/execProcnode.c","sha256":"f8a06a3f539077249b20664b2812433db6d7bd12b2c0ca633525db43d06f112a","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeBitmapAnd.c","path":"src/backend/executor/nodeBitmapAnd.c","sha256":"ec359e3996322cd5f16aab61f23a38e26dae336bbcea4db735a6a70e0ecc89dd","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/include/nodes/plannodes.h","path":"src/include/nodes/plannodes.h","sha256":"52422b327a8049fbbb20d8b96008a0fc0a6fafa60f7eff3c695d5b2e83830120","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-CAVEATS"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-ANALYZE"}]},"MeasuredEvidence":{"runtime_verified":false}},"Text":{"Collection":"plan","Key":"bitmapand","SourceDatabase":"center","Version":"18","Locale":"en","Title":"BitmapAnd","Summary":"Intersects bitmaps produced by its child plans.","BodyHTML":"\u003cp\u003eIntersects bitmaps produced by its child plans.\u003c/p\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"62d462eb213f32dfd1ab3de11b1b22d997404badc20c385f385f26fd499311df","Payload":{"description":["Intersects bitmaps produced by its child plans."],"related":[{"label":"EXPLAIN","url":"/wiki/sql/explain/?v=18"},{"label":"Using EXPLAIN","url":"/docs/18/using-explain.html"},{"label":"Parallel plans","url":"/docs/18/parallel-plans.html"}],"sections":[{"paragraphs":["Structured formats use the Node Type above. Text-format spellings can also include operation, strategy, join type, scan direction or aggregation-stage attributes.","Text names recorded by this source: BitmapAnd.","Parallel-aware and parallel-safe are different plan properties. A node running inside a parallel worker is not necessarily a parallel-aware node."],"title":"EXPLAIN names and attributes"},{"paragraphs":["This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider."],"title":"Memory and temporary storage"},{"paragraphs":["The source callbacks below can coordinate execution or collect worker instrumentation. Their presence is not a blanket claim that this node supports a shared parallel scan or shared state.","Callbacks in this build: none extracted from this node implementation."],"title":"Parallel execution and instrumentation"},{"paragraphs":["BitmapAnd and BitmapOr nodes always report their actual row counts as zero, due to implementation limitations."],"title":"Same-version manual discussion"},{"blocks":[{"code":"EXPLAIN SELECT * FROM tenk1 WHERE unique1 \u003c 100 AND unique2 \u003e 9000;\n\n                                     QUERY PLAN\n-------------------------------------------------------------------------------------\n Bitmap Heap Scan on tenk1  (cost=25.07..60.11 rows=10 width=244)\n   Recheck Cond: ((unique1 \u003c 100) AND (unique2 \u003e 9000))\n   -\u003e  BitmapAnd  (cost=25.07..25.07 rows=10 width=0)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..5.04 rows=100 width=0)\n               Index Cond: (unique1 \u003c 100)\n         -\u003e  Bitmap Index Scan on tenk1_unique2  (cost=0.00..19.78 rows=999 width=0)\n               Index Cond: (unique2 \u003e 9000)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","If there are separate indexes on several of the columns referenced in WHERE , the planner might choose to use an AND or OR combination of the indexes:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN (ANALYZE, BUFFERS OFF) SELECT * FROM tenk1 WHERE unique1 \u003c 100 AND unique2 \u003e 9000;\n\n                                                           QUERY PLAN\n---------------------------------------------------------------------------------------------------------------------------------\n Bitmap Heap Scan on tenk1  (cost=25.07..60.11 rows=10 width=244) (actual time=0.105..0.114 rows=10.00 loops=1)\n   Recheck Cond: ((unique1 \u003c 100) AND (unique2 \u003e 9000))\n   Heap Blocks: exact=10\n   -\u003e  BitmapAnd  (cost=25.07..25.07 rows=10 width=0) (actual time=0.100..0.101 rows=0.00 loops=1)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..5.04 rows=100 width=0) (actual time=0.027..0.027 rows=100.00 loops=1)\n               Index Cond: (unique1 \u003c 100)\n               Index Searches: 1\n         -\u003e  Bitmap Index Scan on tenk1_unique2  (cost=0.00..19.78 rows=999 width=0) (actual time=0.070..0.070 rows=999.00 loops=1)\n               Index Cond: (unique2 \u003e 9000)\n               Index Searches: 1\n Planning Time: 0.162 ms\n Execution Time: 0.143 ms","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","EXPLAIN has a BUFFERS option which provides additional detail about I/O operations performed during the planning and execution of the given query. The buffer numbers displayed show the count of the non-distinct buffers hit, read, dirtied, and written for the given node and all of its child nodes. The ANALYZE option implicitly enables the BUFFERS option. If this is undesired, BUFFERS may be explicitly disabled:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-ANALYZE"}}],"title":"Examples from this manual build"},{"paragraphs":["NOTES BitmapAnd nodes don't make use of their left and right subtrees, rather they maintain a list of subplans, much like Append nodes. The logic is much simpler than Append, however, since we needn't cope with forward/backward execution.","call ExecInitNode on each of the plans to be executed and save the results into the array \"bitmapplanstates\".","BitmapAnd plans don't have expression contexts because they never call ExecQual or ExecProject. They don't need any tuple slots either.","If at any stage we have a completely empty bitmap, we can fall out without evaluating the remaining subplans, since ANDing them can no longer change the result. (Note: the fact that indxpath.c orders the subplans by selectivity should make this case more likely to occur.)","ExecReScan doesn't know about my subplans, so I have to do changed-parameter signaling myself."],"title":"Executor implementation notes"},{"code":"case T_BitmapAnd:\n\t\t\tpname = sname = \"BitmapAnd\";\n\t\t\tbreak;","title":"EXPLAIN identity in core source"}],"tables":[{"columns":[{"key":"label","label":"Text-format label"},{"key":"identity","label":"Structured node identity"}],"key":"explain-labels","rows":[{"identity":"BitmapAnd","label":"BitmapAnd"}],"title":"EXPLAIN labels in this source build"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
