{"Entry":{"collection":"plan","key":"bitmapor","name":"BitmapOr","aliases":["BitmapOr","T_BitmapOr"],"metadata":{"aliases":["BitmapOr","T_BitmapOr"],"category":"Bitmap","content_hash":"7f9182fb8e68ec6e2d9cef66a3b2e1134d354dc29d296ee25b10a06ecfec7c3f","derived_content_hash":"d3e725a02e8a5e824be2e73372f8aaf6152c4b722740a2d79d737e0acf04255e","imported_at":"2026-09-30T00:40:44.03129+08:00","name":"BitmapOr","name_zh":"BitmapOr","slug":"bitmapor","summary":"Unions bitmaps produced by its child plans."}},"Definition":{"Collection":"plan","Key":"bitmapor","SourceDatabase":"center","Version":"18","SourceTable":"plan_node","SourceKey":"bitmapor","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"initializer":"ExecInitBitmapOr","memory_mechanism":"bitmap-lossification","node_tag":"T_BitmapOr","parallel_callbacks":[],"partial_modes":[],"strategies":[],"text_names":["BitmapOr"]},"comparison_hash":"c0ca503a6029c37ec720213dcdc3094997eb194d4920da68f94a7420d3e8f1d2","description":["Unions bitmaps produced by its child plans."],"description_zh":"对各子计划生成的位图求并集。","description_zh_html":"\u003cp\u003e对各子计划生成的位图求并集。\u003c/p\u003e\u003cp\u003e核心节点标识：\u003ccode\u003eT_BitmapOr\u003c/code\u003e；EXPLAIN 名称：\u003ccode\u003eBitmapOr\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":["BitmapOr"],"explain_prefixes":["Parallel","Async"],"facts":[{"label":"Core node tag","value":"T_BitmapOr"},{"label":"Structured EXPLAIN Node Type","value":"BitmapOr"},{"label":"Inputs","value":"Bitmap-producing child plans"},{"label":"Output","value":"Tuple-location bitmap, not a tuple stream"},{"label":"Executor initializer","value":"ExecInitBitmapOr"},{"label":"Memory mechanism","value":"bitmap-lossification"}],"facts_zh":[{"label":"核心节点标签","value":"T_BitmapOr"},{"label":"结构化 EXPLAIN 节点类型","value":"BitmapOr"},{"label":"输入","value":"产生位图的子计划"},{"label":"输出","value":"元组位置位图，不是元组流"},{"label":"执行器初始化函数","value":"ExecInitBitmapOr"},{"label":"内存机制","value":"bitmap-lossification"}],"memory":{"description":"The node allocates a tuple-location bitmap using a work_mem-derived budget. A bitmap can retain page-level lossy entries instead of every tuple location; heap rechecks then remain necessary.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeBitmapOr.c","path":"src/backend/executor/nodeBitmapOr.c","sha256":"81e2aeb0cc0d4cece84b7514385636cd11ea0e1faab93c721d4c3b86c20c9104","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/nodes/tidbitmap.c","path":"src/backend/nodes/tidbitmap.c","sha256":"e2453b7155d55db8c3a59bc929362f01d3f9692b0a483e5aa81a7b6c50db6102","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"bitmap-lossification","source_notes":[]},"node_tag":"T_BitmapOr","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"},{"label":"work_mem","url":"/wiki/guc/work_mem/?v=18"}],"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: BitmapOr.","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":["The node allocates a tuple-location bitmap using a work_mem-derived budget. A bitmap can retain page-level lossy entries instead of every tuple location; heap rechecks then remain necessary."],"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"},{"paragraphs":["NOTES BitmapOr 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\".","BitmapOr plans don't have expression contexts because they never call ExecQual or ExecProject. They don't need any tuple slots either.","We can special-case BitmapIndexScan children to avoid an explicit tbm_union step for each child: just pass down the current result bitmap and let the child OR directly into it.","ExecReScan doesn't know about my subplans, so I have to do changed-parameter signaling myself."],"title":"Executor implementation notes"},{"code":"case T_BitmapOr:\n\t\t\tpname = sname = \"BitmapOr\";\n\t\t\tbreak;","title":"EXPLAIN identity in core source"}],"sections_zh":[{"paragraphs":["结构化格式使用上述 Node Type。文本格式名称还可能包含操作、策略、连接类型、扫描方向或聚合阶段属性。","此源码记录的文本名称：BitmapOr.","并行感知与并行安全是不同的计划属性。在并行工作进程内运行的节点不一定是并行感知节点。"],"title":"EXPLAIN 名称与属性"},{"paragraphs":["此节点按基于 work_mem 的预算分配元组位置位图。位图可以保留页级有损条目，而不记录每个元组位置，因此仍可能需要堆重检。"],"title":"内存与临时存储"},{"paragraphs":["以下源码回调可以协调执行或收集工作进程的测量数据。回调存在不代表该节点普遍支持共享并行扫描或共享状态。","此构建的回调：none extracted from this node implementation."],"title":"并行执行与运行信息采集"},{"paragraphs":["由于实现上的限制，BitmapAnd 和 BitmapOr 节点报告的实际行数始终为零。"],"title":"同版本手册说明"},{"paragraphs":["说明：BitmapOr 不使用左右子树，而像 Append 一样维护子计划列表。不过其逻辑比 Append 简单得多，因为无需处理正向或反向执行。","对每个待执行计划调用 ExecInitNode，并将结果保存到 bitmapplanstates 数组。","BitmapOr 计划没有表达式上下文，因为它们从不调用 ExecQual 或 ExecProject，也不需要元组槽。","可对 BitmapIndexScan 子节点作特殊处理，避免为每个子节点显式调用 tbm_union：直接下传当前结果位图，让子节点将结果按位 OR 合并进去。","ExecReScan 不知道当前节点的子计划，因此必须自行通知子计划哪些参数发生了变化。"],"title":"执行器实现说明"},{"code":"case T_BitmapOr:\n\t\t\tpname = sname = \"BitmapOr\";\n\t\t\tbreak;","title":"核心源码中的 EXPLAIN 标识"}],"source_inventory":{"executor":"src/backend/executor/execProcnode.c","explain":"src/backend/commands/explain.c","implementation":"src/backend/executor/nodeBitmapOr.c"},"sources":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/commands/explain.c:1418","line":1418,"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:201","line":201,"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/nodeBitmapOr.c","path":"src/backend/executor/nodeBitmapOr.c","sha256":"81e2aeb0cc0d4cece84b7514385636cd11ea0e1faab93c721d4c3b86c20c9104","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"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/nodes/tidbitmap.c","path":"src/backend/nodes/tidbitmap.c","sha256":"e2453b7155d55db8c3a59bc929362f01d3f9692b0a483e5aa81a7b6c50db6102","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"}],"strategies":[],"tables":[{"columns":[{"key":"label","label":"Text-format label"},{"key":"identity","label":"Structured node identity"}],"key":"explain-labels","rows":[{"identity":"BitmapOr","label":"BitmapOr"}],"title":"EXPLAIN labels in this source build"}],"tables_zh":[{"columns":[{"key":"label","label":"文本格式标签"},{"key":"identity","label":"结构化节点标识"}],"key":"explain-labels","rows":[{"identity":"BitmapOr","label":"BitmapOr"}],"title":"本构建中的 EXPLAIN 标签"}],"zh_from":{"authored_translation":"authored-translation-of-reviewed-guidance","body_sha256":"37580fd1b2ebc05aad556ddf2ff36fd8835329c1778da435bf49486cd53a86ff","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:1418","line":1418,"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:201","line":201,"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/nodeBitmapOr.c","path":"src/backend/executor/nodeBitmapOr.c","sha256":"81e2aeb0cc0d4cece84b7514385636cd11ea0e1faab93c721d4c3b86c20c9104","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"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/nodes/tidbitmap.c","path":"src/backend/nodes/tidbitmap.c","sha256":"e2453b7155d55db8c3a59bc929362f01d3f9692b0a483e5aa81a7b6c50db6102","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"}]},"MeasuredEvidence":{"runtime_verified":false}},"Text":{"Collection":"plan","Key":"bitmapor","SourceDatabase":"center","Version":"18","Locale":"en","Title":"BitmapOr","Summary":"Unions bitmaps produced by its child plans.","BodyHTML":"\u003cp\u003eUnions bitmaps produced by its child plans.\u003c/p\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"b6bfa268201b42bd46d5b21d3df3c98a49c8c68b9984227d5c58e303b15d79be","Payload":{"description":["Unions 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"},{"label":"work_mem","url":"/wiki/guc/work_mem/?v=18"}],"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: BitmapOr.","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":["The node allocates a tuple-location bitmap using a work_mem-derived budget. A bitmap can retain page-level lossy entries instead of every tuple location; heap rechecks then remain necessary."],"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"},{"paragraphs":["NOTES BitmapOr 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\".","BitmapOr plans don't have expression contexts because they never call ExecQual or ExecProject. They don't need any tuple slots either.","We can special-case BitmapIndexScan children to avoid an explicit tbm_union step for each child: just pass down the current result bitmap and let the child OR directly into it.","ExecReScan doesn't know about my subplans, so I have to do changed-parameter signaling myself."],"title":"Executor implementation notes"},{"code":"case T_BitmapOr:\n\t\t\tpname = sname = \"BitmapOr\";\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":"BitmapOr","label":"BitmapOr"}],"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}
