{"Entry":{"collection":"plan","key":"nested-loop","name":"Nested Loop","aliases":["NestLoop","Nested Loop","T_NestLoop"],"metadata":{"aliases":["NestLoop","Nested Loop","T_NestLoop"],"category":"Join","content_hash":"8924657d1a8499ae4140bc841e5d37b17617e3af649bff66b5d149e1eff46c5a","derived_content_hash":"085fb902b770b8dda3e98777046c262190b36617b30750c3c77ad63fb5e1dd21","imported_at":"2026-09-30T00:40:44.144893+08:00","name":"Nested Loop","name_zh":"NestLoop","slug":"nested-loop","summary":"Rescans the inner plan for outer rows and evaluates the join qualifications."}},"Definition":{"Collection":"plan","Key":"nested-loop","SourceDatabase":"center","Version":"18","SourceTable":"plan_node","SourceKey":"nested-loop","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"initializer":"ExecInitNestLoop","memory_mechanism":"unclassified","node_tag":"T_NestLoop","parallel_callbacks":[],"partial_modes":[],"strategies":[],"text_names":["Nested Loop"]},"comparison_hash":"852ca4868c795edb229c6a1a6741f21e4cec6ee99e843b68527b4563765adf7d","description":["Rescans the inner plan for outer rows and evaluates the join qualifications."],"description_zh":"为外侧行重新扫描内侧计划，并计算连接条件。","description_zh_html":"\u003cp\u003e为外侧行重新扫描内侧计划，并计算连接条件。\u003c/p\u003e\u003cp\u003e核心节点标识：\u003ccode\u003eT_NestLoop\u003c/code\u003e；EXPLAIN 名称：\u003ccode\u003eNested Loop\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e本版本源码中的并行执行或观测回调：该节点实现中未提取到此类回调。回调的存在不表示该节点必然支持共享并行扫描；在并行工作进程中执行也不等于具有并行感知能力。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cp\u003e\n    与非并行计划一样，驱动表可以通过嵌套循环、哈希连接或归并连接与一个或多个其他表连接。连接的内侧可以是规划器支持的任何类型的非并行计划，只要它能够安全地在并行工作进程中运行。根据连接类型，内侧也可以是并行计划。\n  \u003c/p\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/parallel-plans.html#PARALLEL-JOINS\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e\u003cp\u003e本页开头的中文说明为 PG.CENTER 对编辑说明的翻译；手册节选保留对应版本中文文档原文。源码信息及手册示例不代表重新进行过运行测试。\u003c/p\u003e","evidence_kind":"source and documentation","explain_names":["Nested Loop"],"explain_prefixes":["Parallel","Async"],"facts":[{"label":"Core node tag","value":"T_NestLoop"},{"label":"Structured EXPLAIN Node Type","value":"Nested Loop"},{"label":"Inputs","value":"Outer and inner child plans"},{"label":"Output","value":"Joined tuples according to the selected join type"},{"label":"Executor initializer","value":"ExecInitNestLoop"},{"label":"Memory mechanism","value":"unclassified"}],"facts_zh":[{"label":"核心节点标签","value":"T_NestLoop"},{"label":"结构化 EXPLAIN 节点类型","value":"Nested Loop"},{"label":"输入","value":"外侧和内侧子计划"},{"label":"输出","value":"按所选连接类型生成的连接元组"},{"label":"执行器初始化函数","value":"ExecInitNestLoop"},{"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/nodeNestloop.c","path":"src/backend/executor/nodeNestloop.c","sha256":"2d8fbc2a3a31ce10400f0524107d2d083721071b6a384f5d635c11d1d2aeb49c","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"unclassified","source_notes":[]},"node_tag":"T_NestLoop","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":"enable_nestloop","url":"/wiki/guc/enable_nestloop/?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: Nested Loop.","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":["Just as in a non-parallel plan, the driving table may be joined to one or more other tables using a nested loop, hash join, or merge join. The inner side of the join may be any kind of non-parallel plan that is otherwise supported by the planner provided that it is safe to run within a parallel worker. Depending on the join type, the inner side may also be a parallel plan.","In a nested loop join , the inner side is always non-parallel. Although it is executed in full, this is efficient if the inner side is an index scan, because the outer tuples and thus the loops that look up values in the index are divided over the cooperating processes."],"title":"Same-version manual discussion"},{"blocks":[{"code":"EXPLAIN SELECT *\nFROM tenk1 t1, tenk2 t2\nWHERE t1.unique1 \u003c 10 AND t1.unique2 = t2.unique2;\n\n                                      QUERY PLAN\n--------------------------------------------------------------------------------------\n Nested Loop  (cost=4.65..118.50 rows=10 width=488)\n   -\u003e  Bitmap Heap Scan on tenk1 t1  (cost=4.36..39.38 rows=10 width=244)\n         Recheck Cond: (unique1 \u003c 10)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0)\n               Index Cond: (unique1 \u003c 10)\n   -\u003e  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..7.90 rows=1 width=244)\n         Index Cond: (unique2 = t1.unique2)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","Let's try joining two tables, using the columns we have been discussing:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN SELECT *\nFROM tenk1 t1, tenk2 t2\nWHERE t1.unique1 \u003c 10 AND t2.unique2 \u003c 10 AND t1.hundred \u003c t2.hundred;\n\n                                         QUERY PLAN\n---------------------------------------------------------------------------------------------\n Nested Loop  (cost=4.65..49.36 rows=33 width=488)\n   Join Filter: (t1.hundred \u003c t2.hundred)\n   -\u003e  Bitmap Heap Scan on tenk1 t1  (cost=4.36..39.38 rows=10 width=244)\n         Recheck Cond: (unique1 \u003c 10)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0)\n               Index Cond: (unique1 \u003c 10)\n   -\u003e  Materialize  (cost=0.29..8.51 rows=10 width=244)\n         -\u003e  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..8.46 rows=10 width=244)\n               Index Cond: (unique2 \u003c 10)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","In this example the join's output row count is the same as the product of the two scans' row counts, but that's not true in all cases because there can be additional WHERE clauses that mention both tables and so can only be applied at the join point, not to either input scan. Here's an example:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}}],"title":"Examples from this manual build"},{"paragraphs":["old comments Returns the tuple joined from inner and outer tuples which satisfies the qualification clause.","It scans the inner relation to join with current outer tuple.","If none is found, next tuple from the outer relation is retrieved and the inner relation is scanned from the beginning again to join with the outer tuple.","NULL is returned if all the remaining outer tuples are tried and all fail to join with the inner tuples.","NULL is also returned if there is no tuple from inner relation."],"title":"Executor implementation notes"},{"code":"case T_NestLoop:\n\t\t\tpname = sname = \"Nested Loop\";\n\t\t\tbreak;","title":"EXPLAIN identity in core source"}],"sections_zh":[{"paragraphs":["结构化格式使用上述 Node Type。文本格式名称还可能包含操作、策略、连接类型、扫描方向或聚合阶段属性。","此源码记录的文本名称：Nested Loop.","并行感知与并行安全是不同的计划属性。在并行工作进程内运行的节点不一定是并行感知节点。"],"title":"EXPLAIN 名称与属性"},{"paragraphs":["本次抽取不为此节点设定统一的内存上限或落盘策略。请查看同一构建的实现、相关表达式或提供方。"],"title":"内存与临时存储"},{"paragraphs":["以下源码回调可以协调执行或收集工作进程的测量数据。回调存在不代表该节点普遍支持共享并行扫描或共享状态。","此构建的回调：none extracted from this node implementation."],"title":"并行执行与运行信息采集"},{"paragraphs":["与非并行计划一样，驱动表可以通过嵌套循环、哈希连接或归并连接与一个或多个其他表连接。连接的内侧可以是规划器支持的任何类型的非并行计划，只要它能够安全地在并行工作进程中运行。根据连接类型，内侧也可以是并行计划。","在 嵌套循环连接 中，内侧始终是非并行的。尽管它会被完整执行，但如果内侧是索引扫描，这种方式仍然是高效的，因为外侧元组以及在索引中查找值的循环会分摊到多个协作进程上。"],"title":"同版本手册说明"},{"blocks":[{"code":"EXPLAIN SELECT *\nFROM tenk1 t1, tenk2 t2\nWHERE t1.unique1 \u003c 10 AND t1.unique2 = t2.unique2;\n\n                                      QUERY PLAN\n--------------------------------------------------------------------------------------\n Nested Loop  (cost=4.65..118.50 rows=10 width=488)\n   -\u003e  Bitmap Heap Scan on tenk1 t1  (cost=4.36..39.38 rows=10 width=244)\n         Recheck Cond: (unique1 \u003c 10)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0)\n               Index Cond: (unique1 \u003c 10)\n   -\u003e  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..7.90 rows=1 width=244)\n         Index Cond: (unique2 = t1.unique2)","paragraphs":["示例摘自 PostgreSQL 18.6 手册；本百科未实际执行此示例。","使用前面讨论的列，尝试连接两个表："],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN SELECT *\nFROM tenk1 t1, tenk2 t2\nWHERE t1.unique1 \u003c 10 AND t2.unique2 \u003c 10 AND t1.hundred \u003c t2.hundred;\n\n                                         QUERY PLAN\n---------------------------------------------------------------------------------------------\n Nested Loop  (cost=4.65..49.36 rows=33 width=488)\n   Join Filter: (t1.hundred \u003c t2.hundred)\n   -\u003e  Bitmap Heap Scan on tenk1 t1  (cost=4.36..39.38 rows=10 width=244)\n         Recheck Cond: (unique1 \u003c 10)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0)\n               Index Cond: (unique1 \u003c 10)\n   -\u003e  Materialize  (cost=0.29..8.51 rows=10 width=244)\n         -\u003e  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..8.46 rows=10 width=244)\n               Index Cond: (unique2 \u003c 10)","paragraphs":["示例摘自 PostgreSQL 18.6 手册；本百科未实际执行此示例。","本例中，连接的输出行数等于两次扫描行数的乘积，但并非总是如此：可能存在同时引用两个表的额外 WHERE 子句，只能在连接时应用，无法应用到任何单侧输入扫描。示例如下："],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}}],"title":"本版手册中的示例"},{"paragraphs":["旧注释：返回由内外侧元组连接产生且满足筛选条件的元组。","扫描内侧关系，将其与当前外侧元组连接。","如果未找到匹配项，则从外侧关系获取下一个元组，再从头扫描内侧关系，与该外侧元组进行连接。","尝试了所有剩余外侧元组且都无法与内侧元组连接时，返回 NULL。","内侧关系没有元组时也返回 NULL。"],"title":"执行器实现说明"},{"code":"case T_NestLoop:\n\t\t\tpname = sname = \"Nested Loop\";\n\t\t\tbreak;","title":"核心源码中的 EXPLAIN 标识"}],"source_inventory":{"executor":"src/backend/executor/execProcnode.c","explain":"src/backend/commands/explain.c","implementation":"src/backend/executor/nodeNestloop.c"},"sources":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/commands/explain.c:1421","line":1421,"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:297","line":297,"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/nodeNestloop.c","path":"src/backend/executor/nodeNestloop.c","sha256":"2d8fbc2a3a31ce10400f0524107d2d083721071b6a384f5d635c11d1d2aeb49c","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 · parallel-plans","path":"parallel-plans.html","sha256":"62207d207bead82b01b59dc119c4f95856f08655cc11d4699a05a40867ed2070","url":"/docs/18/parallel-plans.html#PARALLEL-JOINS"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}],"strategies":[],"tables":[{"columns":[{"key":"label","label":"Text-format label"},{"key":"identity","label":"Structured node identity"}],"key":"explain-labels","rows":[{"identity":"Nested Loop","label":"Nested Loop"}],"title":"EXPLAIN labels in this source build"}],"tables_zh":[{"columns":[{"key":"label","label":"文本格式标签"},{"key":"identity","label":"结构化节点标识"}],"key":"explain-labels","rows":[{"identity":"Nested Loop","label":"Nested Loop"}],"title":"本构建中的 EXPLAIN 标签"}],"zh_from":{"authored_translation":"authored-translation-of-reviewed-guidance","body_sha256":"34cce2f5ce73b2cf81187b6bbc58e3b04b50d5c79f775c9def868b43f2c6dc00","kind":"same-version-chinese-manual-with-authored-translation-of-reviewed-guidance","manual":{"anchor":"PARALLEL-JOINS","build_id":107,"extraction":"concept-introduction","fragment_sha256":"a43f0de57b5ae52c535422d6a32e40f1d7c7f194471bf7716a826b4897233a21","locale":"zh-Hans","page_key":"parallel-plans.html","source_hash":"1ef9f9a3740440f8dcdf04c2a2dfe2f7d48c66f2e0b102d15df580bff22a6857","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/parallel-plans.html#PARALLEL-JOINS","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:1421","line":1421,"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:297","line":297,"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/nodeNestloop.c","path":"src/backend/executor/nodeNestloop.c","sha256":"2d8fbc2a3a31ce10400f0524107d2d083721071b6a384f5d635c11d1d2aeb49c","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 · parallel-plans","path":"parallel-plans.html","sha256":"62207d207bead82b01b59dc119c4f95856f08655cc11d4699a05a40867ed2070","url":"/docs/18/parallel-plans.html#PARALLEL-JOINS"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}]},"MeasuredEvidence":{"runtime_verified":false}},"Text":{"Collection":"plan","Key":"nested-loop","SourceDatabase":"center","Version":"18","Locale":"en","Title":"Nested Loop","Summary":"Rescans the inner plan for outer rows and evaluates the join qualifications.","BodyHTML":"\u003cp\u003eRescans the inner plan for outer rows and evaluates the join qualifications.\u003c/p\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"a1c85e0c469a63d3f3b2aeb722df7ac3a22cacf36ba8bdafb9e00f0e194fb960","Payload":{"description":["Rescans the inner plan for outer rows and evaluates the join qualifications."],"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":"enable_nestloop","url":"/wiki/guc/enable_nestloop/?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: Nested Loop.","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":["Just as in a non-parallel plan, the driving table may be joined to one or more other tables using a nested loop, hash join, or merge join. The inner side of the join may be any kind of non-parallel plan that is otherwise supported by the planner provided that it is safe to run within a parallel worker. Depending on the join type, the inner side may also be a parallel plan.","In a nested loop join , the inner side is always non-parallel. Although it is executed in full, this is efficient if the inner side is an index scan, because the outer tuples and thus the loops that look up values in the index are divided over the cooperating processes."],"title":"Same-version manual discussion"},{"blocks":[{"code":"EXPLAIN SELECT *\nFROM tenk1 t1, tenk2 t2\nWHERE t1.unique1 \u003c 10 AND t1.unique2 = t2.unique2;\n\n                                      QUERY PLAN\n--------------------------------------------------------------------------------------\n Nested Loop  (cost=4.65..118.50 rows=10 width=488)\n   -\u003e  Bitmap Heap Scan on tenk1 t1  (cost=4.36..39.38 rows=10 width=244)\n         Recheck Cond: (unique1 \u003c 10)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0)\n               Index Cond: (unique1 \u003c 10)\n   -\u003e  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..7.90 rows=1 width=244)\n         Index Cond: (unique2 = t1.unique2)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","Let's try joining two tables, using the columns we have been discussing:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN SELECT *\nFROM tenk1 t1, tenk2 t2\nWHERE t1.unique1 \u003c 10 AND t2.unique2 \u003c 10 AND t1.hundred \u003c t2.hundred;\n\n                                         QUERY PLAN\n---------------------------------------------------------------------------------------------\n Nested Loop  (cost=4.65..49.36 rows=33 width=488)\n   Join Filter: (t1.hundred \u003c t2.hundred)\n   -\u003e  Bitmap Heap Scan on tenk1 t1  (cost=4.36..39.38 rows=10 width=244)\n         Recheck Cond: (unique1 \u003c 10)\n         -\u003e  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0)\n               Index Cond: (unique1 \u003c 10)\n   -\u003e  Materialize  (cost=0.29..8.51 rows=10 width=244)\n         -\u003e  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..8.46 rows=10 width=244)\n               Index Cond: (unique2 \u003c 10)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","In this example the join's output row count is the same as the product of the two scans' row counts, but that's not true in all cases because there can be additional WHERE clauses that mention both tables and so can only be applied at the join point, not to either input scan. Here's an example:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}}],"title":"Examples from this manual build"},{"paragraphs":["old comments Returns the tuple joined from inner and outer tuples which satisfies the qualification clause.","It scans the inner relation to join with current outer tuple.","If none is found, next tuple from the outer relation is retrieved and the inner relation is scanned from the beginning again to join with the outer tuple.","NULL is returned if all the remaining outer tuples are tried and all fail to join with the inner tuples.","NULL is also returned if there is no tuple from inner relation."],"title":"Executor implementation notes"},{"code":"case T_NestLoop:\n\t\t\tpname = sname = \"Nested Loop\";\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":"Nested Loop","label":"Nested Loop"}],"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}
