{"Entry":{"collection":"plan","key":"bitmapand","name":"BitmapAnd","aliases":["BitmapAnd","T_BitmapAnd"],"metadata":{"aliases":["BitmapAnd","T_BitmapAnd"],"category":"Bitmap","content_hash":"6423b728057b60c165593b809d228f82bbf02a433dcc1d69ba1105867136eb95","derived_content_hash":"f42206ac226ee1a1e63d0e6fbaa20dde7f902afd17af70a375370449ee17568d","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."],"description_zh":"对各子计划生成的位图求交集。","description_zh_html":"\u003cp\u003e对各子计划生成的位图求交集。\u003c/p\u003e\u003cp\u003e核心节点标识：\u003ccode\u003eT_BitmapAnd\u003c/code\u003e；EXPLAIN 名称：\u003ccode\u003eBitmapAnd\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e本版本源码中的并行执行或观测回调：该节点实现中未提取到此类回调。回调的存在不表示该节点必然支持共享并行扫描；在并行工作进程中执行也不等于具有并行感知能力。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eEXPLAIN ANALYZE\u003c/code\u003e 测得的运行时间，可能以两种重要方式偏离同一查询的正常执行时间。第一，由于不会向客户端传递任何输出行，因此网络传输开销不会被计入。除非指定了 \u003ccode class=\"literal\"\u003eSERIALIZE\u003c/code\u003e，I/O 转换开销同样也不会被计入。第二，\u003ccode class=\"command\"\u003eEXPLAIN ANALYZE\u003c/code\u003e 附加的测量开销本身可能相当可观，尤其是在操作系统调用 \u003ccode class=\"function\"\u003egettimeofday()\u003c/code\u003e 较慢的机器上。可以使用 \u003ca class=\"xref\" href=\"/zh/docs/18/pgtesttiming.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_test_timing\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 工具来测量系统上的计时开销。\n   \u003c/p\u003e\u003cp\u003e\n    不应将 \u003ccode class=\"command\"\u003eEXPLAIN\u003c/code\u003e 结果外推到与实际测试场景差异很大的情况。例如，在一个很小的表上得到的结果，不能假定也适用于大型表。规划器的代价估计不是线性的，因此它可能会为更大或更小的表选择不同的计划。一个极端示例是：对于只占用一个磁盘页的表，无论索引是否可用，几乎总会得到顺序扫描计划。规划器认识到，无论如何处理该表都需要一次磁盘页读取，因此再额外读取页面去查看索引并没有价值。（前面的 \u003ccode class=\"literal\"\u003epolygon_tbl\u003c/code\u003e 示例已经展示过这种情况。）\n   \u003c/p\u003e\u003cp\u003e\n    在某些情况下，实际值和估计值不会很好地对应，但这并不表示出现了问题。其中一种情况是，计划节点的执行会被 \u003ccode class=\"literal\"\u003eLIMIT\u003c/code\u003e 或类似效果提前截断。例如，在前面用过的 \u003ccode class=\"literal\"\u003eLIMIT\u003c/code\u003e 查询中：\n\n\u003c/p\u003e\u003cp\u003e\n\n    Index Scan 节点的估计代价和行计数显示得像是它会运行到结束一样。但实际上，Limit 节点在拿到两行之后就停止请求更多行，因此实际行计数只有 2，运行时间也低于代价估计所暗示的水平。这并不是估计错误，只是估计值与真实值的显示方式不同而已。\n   \u003c/p\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/using-explain.html#USING-EXPLAIN-CAVEATS\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e\u003cp\u003e本页开头的中文说明为 PG.CENTER 对编辑说明的翻译；手册节选保留对应版本中文文档原文。源码信息及手册示例不代表重新进行过运行测试。\u003c/p\u003e","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"}],"facts_zh":[{"label":"核心节点标签","value":"T_BitmapAnd"},{"label":"结构化 EXPLAIN 节点类型","value":"BitmapAnd"},{"label":"输入","value":"产生位图的子计划"},{"label":"输出","value":"元组位置位图，不是元组流"},{"label":"执行器初始化函数","value":"ExecInitBitmapAnd"},{"label":"内存机制","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"}],"sections_zh":[{"paragraphs":["结构化格式使用上述 Node Type。文本格式名称还可能包含操作、策略、连接类型、扫描方向或聚合阶段属性。","此源码记录的文本名称：BitmapAnd.","并行感知与并行安全是不同的计划属性。在并行工作进程内运行的节点不一定是并行感知节点。"],"title":"EXPLAIN 名称与属性"},{"paragraphs":["本次抽取不为此节点设定统一的内存上限或落盘策略。请查看同一构建的实现、相关表达式或提供方。"],"title":"内存与临时存储"},{"paragraphs":["以下源码回调可以协调执行或收集工作进程的测量数据。回调存在不代表该节点普遍支持共享并行扫描或共享状态。","此构建的回调：none extracted from this node implementation."],"title":"并行执行与运行信息采集"},{"paragraphs":["由于实现上的限制，BitmapAnd 和 BitmapOr 节点报告的实际行数始终为零。"],"title":"同版本手册说明"},{"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":["示例摘自 PostgreSQL 18.6 手册；本百科未实际执行此示例。","如果 WHERE 引用的多个列上分别建有索引，规划器可能选择用 AND 或 OR 组合这些索引："],"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":["示例摘自 PostgreSQL 18.6 手册；本百科未实际执行此示例。","EXPLAIN 有一个 BUFFERS 选项，可为给定查询在规划和执行期间执行的 I/O 操作提供更详细的信息。显示出来的缓冲区数字，是该节点及其所有子节点所命中的、读取的、弄脏的和写出的非去重缓冲区总数。 ANALYZE 选项会隐式启用 BUFFERS 。如果不希望如此，也可以显式关闭 BUFFERS ："],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-ANALYZE"}}],"title":"本版手册中的示例"},{"paragraphs":["说明：BitmapAnd 不使用左右子树，而像 Append 一样维护子计划列表。不过其逻辑比 Append 简单得多，因为无需处理正向或反向执行。","对每个待执行计划调用 ExecInitNode，并将结果保存到 bitmapplanstates 数组。","BitmapAnd 计划没有表达式上下文，因为它们从不调用 ExecQual 或 ExecProject，也不需要元组槽。","如果在任何阶段得到完全为空的位图，就可以直接退出，无需执行剩余子计划，因为再进行 AND 运算也不会改变结果。（注意：indxpath.c 按选择率对子计划排序，应当能提高出现这种情况的概率。）","ExecReScan 不知道当前节点的子计划，因此必须自行通知子计划哪些参数发生了变化。"],"title":"执行器实现说明"},{"code":"case T_BitmapAnd:\n\t\t\tpname = sname = \"BitmapAnd\";\n\t\t\tbreak;","title":"核心源码中的 EXPLAIN 标识"}],"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"}],"tables_zh":[{"columns":[{"key":"label","label":"文本格式标签"},{"key":"identity","label":"结构化节点标识"}],"key":"explain-labels","rows":[{"identity":"BitmapAnd","label":"BitmapAnd"}],"title":"本构建中的 EXPLAIN 标签"}],"zh_from":{"authored_translation":"authored-translation-of-reviewed-guidance","body_sha256":"b8bfe9563e9c7a517a026f37c09fb2b433e3b6dde46848a1f7fc306d88302d87","kind":"same-version-chinese-manual-with-authored-translation-of-reviewed-guidance","manual":{"anchor":"USING-EXPLAIN-CAVEATS","build_id":107,"extraction":"concept-introduction","fragment_sha256":"1726362ef840934bdec0f9ec72c682b2350a203639c9fd1e22dc5d29ac24ca1f","locale":"zh-Hans","page_key":"using-explain.html","source_hash":"d2f749744b3ac5aa2eb0154f295e8163903cd20fcc130c74c6172cdf2ae3a9df","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/using-explain.html#USING-EXPLAIN-CAVEATS","version":"18"},"runtime_rerun":false,"source_facts_revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}},"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":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
