@quereus/quereus 4.15.2 → 4.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/src/core/database-auto-analyze.d.ts +258 -0
  2. package/dist/src/core/database-auto-analyze.d.ts.map +1 -0
  3. package/dist/src/core/database-auto-analyze.js +616 -0
  4. package/dist/src/core/database-auto-analyze.js.map +1 -0
  5. package/dist/src/core/database-materialized-views.d.ts +42 -1
  6. package/dist/src/core/database-materialized-views.d.ts.map +1 -1
  7. package/dist/src/core/database-materialized-views.js +76 -3
  8. package/dist/src/core/database-materialized-views.js.map +1 -1
  9. package/dist/src/core/database-transaction.d.ts +17 -0
  10. package/dist/src/core/database-transaction.d.ts.map +1 -1
  11. package/dist/src/core/database-transaction.js +37 -0
  12. package/dist/src/core/database-transaction.js.map +1 -1
  13. package/dist/src/core/database.d.ts +8 -1
  14. package/dist/src/core/database.d.ts.map +1 -1
  15. package/dist/src/core/database.js +135 -5
  16. package/dist/src/core/database.js.map +1 -1
  17. package/dist/src/index.d.ts +1 -1
  18. package/dist/src/index.d.ts.map +1 -1
  19. package/dist/src/index.js +1 -1
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/planner/analysis/change-scope.d.ts.map +1 -1
  22. package/dist/src/planner/analysis/change-scope.js +8 -8
  23. package/dist/src/planner/analysis/change-scope.js.map +1 -1
  24. package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
  25. package/dist/src/planner/analysis/constraint-extractor.js +27 -14
  26. package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
  27. package/dist/src/planner/analysis/expression-fingerprint.d.ts.map +1 -1
  28. package/dist/src/planner/analysis/expression-fingerprint.js +23 -2
  29. package/dist/src/planner/analysis/expression-fingerprint.js.map +1 -1
  30. package/dist/src/planner/analysis/mv-body-functions.d.ts +46 -0
  31. package/dist/src/planner/analysis/mv-body-functions.d.ts.map +1 -0
  32. package/dist/src/planner/analysis/mv-body-functions.js +65 -0
  33. package/dist/src/planner/analysis/mv-body-functions.js.map +1 -0
  34. package/dist/src/planner/analysis/predicate-shape.d.ts +32 -4
  35. package/dist/src/planner/analysis/predicate-shape.d.ts.map +1 -1
  36. package/dist/src/planner/analysis/predicate-shape.js +37 -5
  37. package/dist/src/planner/analysis/predicate-shape.js.map +1 -1
  38. package/dist/src/planner/analysis/query-rewrite-matcher.d.ts +2 -2
  39. package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
  40. package/dist/src/planner/analysis/query-rewrite-matcher.js +46 -6
  41. package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
  42. package/dist/src/planner/analysis/sat-checker.js +2 -5
  43. package/dist/src/planner/analysis/sat-checker.js.map +1 -1
  44. package/dist/src/planner/building/select-aggregates.d.ts +17 -5
  45. package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
  46. package/dist/src/planner/building/select-aggregates.js +122 -79
  47. package/dist/src/planner/building/select-aggregates.js.map +1 -1
  48. package/dist/src/planner/building/select-modifiers.d.ts +1 -1
  49. package/dist/src/planner/building/select.d.ts.map +1 -1
  50. package/dist/src/planner/building/select.js +73 -55
  51. package/dist/src/planner/building/select.js.map +1 -1
  52. package/dist/src/planner/cost/index.d.ts +14 -0
  53. package/dist/src/planner/cost/index.d.ts.map +1 -1
  54. package/dist/src/planner/cost/index.js +19 -0
  55. package/dist/src/planner/cost/index.js.map +1 -1
  56. package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
  57. package/dist/src/planner/nodes/limit-offset.js +3 -2
  58. package/dist/src/planner/nodes/limit-offset.js.map +1 -1
  59. package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
  60. package/dist/src/planner/nodes/table-access-nodes.js +31 -7
  61. package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
  62. package/dist/src/planner/optimizer-tuning.d.ts +10 -6
  63. package/dist/src/planner/optimizer-tuning.d.ts.map +1 -1
  64. package/dist/src/planner/optimizer-tuning.js.map +1 -1
  65. package/dist/src/planner/optimizer.d.ts.map +1 -1
  66. package/dist/src/planner/optimizer.js +24 -0
  67. package/dist/src/planner/optimizer.js.map +1 -1
  68. package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
  69. package/dist/src/planner/rules/access/rule-monotonic-range-access.js +8 -4
  70. package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
  71. package/dist/src/planner/rules/access/rule-select-access-path.d.ts +14 -0
  72. package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
  73. package/dist/src/planner/rules/access/rule-select-access-path.js +5 -1
  74. package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
  75. package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts +3 -1
  76. package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts.map +1 -1
  77. package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js +8 -3
  78. package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js.map +1 -1
  79. package/dist/src/planner/rules/aggregate/rule-minmax-index-boundary.d.ts +47 -0
  80. package/dist/src/planner/rules/aggregate/rule-minmax-index-boundary.d.ts.map +1 -0
  81. package/dist/src/planner/rules/aggregate/rule-minmax-index-boundary.js +200 -0
  82. package/dist/src/planner/rules/aggregate/rule-minmax-index-boundary.js.map +1 -0
  83. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.d.ts +29 -0
  84. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.d.ts.map +1 -1
  85. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js +55 -16
  86. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js.map +1 -1
  87. package/dist/src/planner/rules/join/index-nested-loop.d.ts +96 -22
  88. package/dist/src/planner/rules/join/index-nested-loop.d.ts.map +1 -1
  89. package/dist/src/planner/rules/join/index-nested-loop.js +401 -82
  90. package/dist/src/planner/rules/join/index-nested-loop.js.map +1 -1
  91. package/dist/src/planner/rules/join/rule-fanout-batched-outer.d.ts +20 -0
  92. package/dist/src/planner/rules/join/rule-fanout-batched-outer.d.ts.map +1 -1
  93. package/dist/src/planner/rules/join/rule-fanout-batched-outer.js +23 -4
  94. package/dist/src/planner/rules/join/rule-fanout-batched-outer.js.map +1 -1
  95. package/dist/src/planner/rules/join/rule-join-greedy-commute.d.ts.map +1 -1
  96. package/dist/src/planner/rules/join/rule-join-greedy-commute.js +7 -0
  97. package/dist/src/planner/rules/join/rule-join-greedy-commute.js.map +1 -1
  98. package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts +19 -2
  99. package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
  100. package/dist/src/planner/rules/join/rule-join-physical-selection.js +262 -40
  101. package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
  102. package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.d.ts.map +1 -1
  103. package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.js +2 -1
  104. package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.js.map +1 -1
  105. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts +21 -0
  106. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
  107. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +24 -6
  108. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
  109. package/dist/src/planner/rules/shared/access-leaf.d.ts +12 -12
  110. package/dist/src/planner/rules/shared/access-leaf.d.ts.map +1 -1
  111. package/dist/src/planner/rules/shared/access-leaf.js +3 -14
  112. package/dist/src/planner/rules/shared/access-leaf.js.map +1 -1
  113. package/dist/src/planner/stats/analyze.d.ts.map +1 -1
  114. package/dist/src/planner/stats/analyze.js +9 -3
  115. package/dist/src/planner/stats/analyze.js.map +1 -1
  116. package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
  117. package/dist/src/planner/stats/catalog-stats.js +6 -10
  118. package/dist/src/planner/stats/catalog-stats.js.map +1 -1
  119. package/dist/src/planner/type-utils.d.ts.map +1 -1
  120. package/dist/src/planner/type-utils.js +3 -5
  121. package/dist/src/planner/type-utils.js.map +1 -1
  122. package/dist/src/planner/util/fd-utils.d.ts.map +1 -1
  123. package/dist/src/planner/util/fd-utils.js +4 -7
  124. package/dist/src/planner/util/fd-utils.js.map +1 -1
  125. package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
  126. package/dist/src/runtime/emit/alter-table.js +58 -4
  127. package/dist/src/runtime/emit/alter-table.js.map +1 -1
  128. package/dist/src/runtime/emit/analyze.d.ts.map +1 -1
  129. package/dist/src/runtime/emit/analyze.js +1 -2
  130. package/dist/src/runtime/emit/analyze.js.map +1 -1
  131. package/dist/src/runtime/emit/binary.d.ts.map +1 -1
  132. package/dist/src/runtime/emit/binary.js +5 -3
  133. package/dist/src/runtime/emit/binary.js.map +1 -1
  134. package/dist/src/runtime/emit/fanout-lookup-join.d.ts.map +1 -1
  135. package/dist/src/runtime/emit/fanout-lookup-join.js +9 -1
  136. package/dist/src/runtime/emit/fanout-lookup-join.js.map +1 -1
  137. package/dist/src/runtime/emit/limit-offset.d.ts.map +1 -1
  138. package/dist/src/runtime/emit/limit-offset.js +50 -24
  139. package/dist/src/runtime/emit/limit-offset.js.map +1 -1
  140. package/dist/src/runtime/emit/materialized-view-helpers.d.ts +33 -2
  141. package/dist/src/runtime/emit/materialized-view-helpers.d.ts.map +1 -1
  142. package/dist/src/runtime/emit/materialized-view-helpers.js +61 -5
  143. package/dist/src/runtime/emit/materialized-view-helpers.js.map +1 -1
  144. package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
  145. package/dist/src/runtime/emit/materialized-view.js +6 -1
  146. package/dist/src/runtime/emit/materialized-view.js.map +1 -1
  147. package/dist/src/runtime/emit/ordinal-slice.d.ts.map +1 -1
  148. package/dist/src/runtime/emit/ordinal-slice.js +8 -0
  149. package/dist/src/runtime/emit/ordinal-slice.js.map +1 -1
  150. package/dist/src/schema/derivation.d.ts +15 -1
  151. package/dist/src/schema/derivation.d.ts.map +1 -1
  152. package/dist/src/schema/derivation.js.map +1 -1
  153. package/dist/src/schema/function.d.ts +9 -4
  154. package/dist/src/schema/function.d.ts.map +1 -1
  155. package/dist/src/schema/function.js +11 -9
  156. package/dist/src/schema/function.js.map +1 -1
  157. package/dist/src/schema/schema.d.ts +14 -3
  158. package/dist/src/schema/schema.d.ts.map +1 -1
  159. package/dist/src/schema/schema.js +20 -2
  160. package/dist/src/schema/schema.js.map +1 -1
  161. package/dist/src/schema/table.d.ts +27 -0
  162. package/dist/src/schema/table.d.ts.map +1 -1
  163. package/dist/src/schema/table.js +55 -0
  164. package/dist/src/schema/table.js.map +1 -1
  165. package/dist/src/schema/unique-enforcement.d.ts +6 -13
  166. package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
  167. package/dist/src/schema/unique-enforcement.js +8 -17
  168. package/dist/src/schema/unique-enforcement.js.map +1 -1
  169. package/dist/src/util/comparison.d.ts +19 -0
  170. package/dist/src/util/comparison.d.ts.map +1 -1
  171. package/dist/src/util/comparison.js +22 -0
  172. package/dist/src/util/comparison.js.map +1 -1
  173. package/dist/src/vtab/best-access-plan.d.ts +34 -0
  174. package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
  175. package/dist/src/vtab/best-access-plan.js +64 -0
  176. package/dist/src/vtab/best-access-plan.js.map +1 -1
  177. package/dist/src/vtab/index-descriptor.d.ts +9 -0
  178. package/dist/src/vtab/index-descriptor.d.ts.map +1 -1
  179. package/dist/src/vtab/index-descriptor.js +15 -0
  180. package/dist/src/vtab/index-descriptor.js.map +1 -1
  181. package/dist/src/vtab/memory/layer/manager.d.ts +11 -9
  182. package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
  183. package/dist/src/vtab/memory/layer/manager.js +12 -43
  184. package/dist/src/vtab/memory/layer/manager.js.map +1 -1
  185. package/dist/src/vtab/memory/module.d.ts +18 -0
  186. package/dist/src/vtab/memory/module.d.ts.map +1 -1
  187. package/dist/src/vtab/memory/module.js +176 -24
  188. package/dist/src/vtab/memory/module.js.map +1 -1
  189. package/dist/src/vtab/memory/table.d.ts +27 -3
  190. package/dist/src/vtab/memory/table.d.ts.map +1 -1
  191. package/dist/src/vtab/memory/table.js +28 -59
  192. package/dist/src/vtab/memory/table.js.map +1 -1
  193. package/package.json +3 -3
@@ -103,14 +103,18 @@ function estimateRightRows(node) {
103
103
  }
104
104
  return max;
105
105
  }
106
- export function ruleNestedLoopRightCache(node, context) {
107
- // Only logical JoinNodes reach here uncached. By PostOptimization,
108
- // join-physical-selection has already converted every equi-join it wanted to
109
- // hash/merge (those materialize their build side), so any surviving logical
110
- // JoinNode IS a nested loop — the exact structural signal we need.
111
- if (!(node instanceof JoinNode)) {
112
- return null;
113
- }
106
+ /**
107
+ * Would this join's right side be wrapped in a `CacheNode` by
108
+ * {@link ruleNestedLoopRightCache}? The single source of truth for that
109
+ * question: the rule below calls it and then builds the node, and
110
+ * `rule-join-physical-selection` calls it to decide whether a plain nested loop
111
+ * pays its inner side's first-row latency ONCE (cached: one open plus N buffer
112
+ * replays) or once per outer row (uncached: N re-opens). Neither caller may
113
+ * restate any of the gates.
114
+ *
115
+ * Every gate is a decline; the comments on each explain what it protects.
116
+ */
117
+ export function canCacheNestedLoopRight(node, context) {
114
118
  // Driver gate: only the left-driven join types re-scan the right side.
115
119
  // `right` / `full` buffer the left side once and scan the right side once
116
120
  // (`emitLoopJoin.driveFromRight`), so caching their right side is pure waste.
@@ -124,23 +128,23 @@ export function ruleNestedLoopRightCache(node, context) {
124
128
  // (same reopen count until the buffer fills, a win after), just data-dependent
125
129
  // rather than the guaranteed replay inner/cross/left get.
126
130
  if (node.joinType === 'right' || node.joinType === 'full') {
127
- return null;
131
+ return false;
128
132
  }
129
133
  const right = node.right;
130
134
  // Already cached (e.g. by cte / in-subquery / mutating-subquery cache).
131
135
  if (CapabilityDetectors.isCached(right) && right.isCached()) {
132
- return null;
136
+ return false;
133
137
  }
134
138
  // Purity gate: side effects are the mutating-subquery-cache rule's job.
135
139
  // Double-wrapping a write would change nothing and only burn memory.
136
140
  if (PlanNodeCharacteristics.subtreeHasSideEffects(right)) {
137
- return null;
141
+ return false;
138
142
  }
139
143
  // Determinism gate: a non-deterministic right side (e.g. `random()`) must be
140
144
  // re-evaluated per left row to preserve today's observable behavior; caching
141
145
  // would freeze the first scan's values across every subsequent left row.
142
146
  if (!PlanNodeCharacteristics.isDeterministic(right)) {
143
- return null;
147
+ return false;
144
148
  }
145
149
  // Correlation gate: a right subtree that references left attributes (a
146
150
  // parameterized/lateral seek produced by predicate pushdown) is
@@ -149,24 +153,59 @@ export function ruleNestedLoopRightCache(node, context) {
149
153
  // separate JoinNode.condition child, not inside the right subtree — so the
150
154
  // bare right access has no external refs and is cacheable.
151
155
  if (isCorrelatedSubquery(right)) {
152
- return null;
156
+ return false;
153
157
  }
154
158
  // CTE-safety gate: eagerly materializing a CTE-backed right side breaks the
155
159
  // join's row-context at runtime (see subtreeTouchesCte above).
156
160
  if (subtreeTouchesCte(right)) {
157
- return null;
161
+ return false;
158
162
  }
159
163
  // Size gate (memory safety): materializing an unbounded right side trades I/O
160
164
  // for memory. Respect the existing nested-loop caching threshold.
161
165
  const estimatedRows = estimateRightRows(right) ?? context.tuning.defaultRowEstimate;
162
166
  if (estimatedRows > context.tuning.join.maxRightRowsForCaching) {
163
167
  log('Right side too large to cache (%d rows > %d), skipping', estimatedRows, context.tuning.join.maxRightRowsForCaching);
168
+ return false;
169
+ }
170
+ return true;
171
+ }
172
+ /**
173
+ * Is this join's right side opened ONCE per join rather than once per outer row?
174
+ * True two ways: it is already materialized (a `CacheNode` from this rule on an
175
+ * earlier visit, or from the cte / in-subquery / mutating-subquery caches — all
176
+ * of which scan once and replay a buffer), or {@link canCacheNestedLoopRight}
177
+ * says this rule is about to make it so.
178
+ *
179
+ * `rule-join-physical-selection` asks THIS question, not the cacheability one:
180
+ * the two differ exactly on an already-cached right side, which
181
+ * `canCacheNestedLoopRight` declines (nothing left to do) but which pays its
182
+ * first-row latency once, not per outer row. Pricing that side per outer row
183
+ * made the selection rule re-visit a join this rule had just improved, re-price
184
+ * its nested loop as if the cache were not there, and convert it to a hash join
185
+ * — discarding the cache and landing on the costlier plan.
186
+ */
187
+ export function nestedLoopRightOpensOnce(node, context) {
188
+ const right = node.right;
189
+ if (CapabilityDetectors.isCached(right) && right.isCached())
190
+ return true;
191
+ return canCacheNestedLoopRight(node, context);
192
+ }
193
+ export function ruleNestedLoopRightCache(node, context) {
194
+ // Only logical JoinNodes reach here uncached. By PostOptimization,
195
+ // join-physical-selection has already converted every equi-join it wanted to
196
+ // hash/merge (those materialize their build side), so any surviving logical
197
+ // JoinNode IS a nested loop — the exact structural signal we need.
198
+ if (!(node instanceof JoinNode)) {
199
+ return null;
200
+ }
201
+ if (!canCacheNestedLoopRight(node, context)) {
164
202
  return null;
165
203
  }
166
- log('Caching pure nested-loop right side (%s, %d rows)', node.joinType, estimatedRows);
204
+ const right = node.right;
205
+ log('Caching pure nested-loop right side (%s)', node.joinType);
167
206
  // Memory strategy + a CacheNode threshold (which degrades to pass-through
168
207
  // past its limit) mirrors the sibling mutating-subquery-cache rule. Spill is
169
- // unreachable under the size gate above (maxRightRowsForCaching <
208
+ // unreachable under `canCacheNestedLoopRight`'s size gate (maxRightRowsForCaching <
170
209
  // cache.spillThreshold), so 'memory' is the only live choice here.
171
210
  const threshold = CachingAnalysis.getCacheThreshold(right);
172
211
  const cached = new CacheNode(right.scope, right, 'memory', threshold);
@@ -1 +1 @@
1
- {"version":3,"file":"rule-nested-loop-right-cache.js","sourceRoot":"","sources":["../../../../../src/planner/rules/cache/rule-nested-loop-right-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE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CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtE,+EAA+E;IAC/E,+EAA+E;IAC/E,0EAA0E;IAC1E,OAAO,IAAI,CAAC,YAAY,CACvB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAC1E,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"rule-nested-loop-right-cache.js","sourceRoot":"","sources":["../../../../../src/planner/rules/cache/rule-nested-loop-right-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,GAAG,GAAG,YAAY,CAAC,wCAAwC,CAAC,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,cAAc,GAA8B,IAAI,GAAG,CAAC;IACzD,YAAY,CAAC,YAAY;IACzB,YAAY,CAAC,GAAG;IAChB,YAAY,CAAC,YAAY;IACzB,YAAY,CAAC,uBAAuB;CACpC,CAAC,CAAC;AAEH,6EAA6E;AAC7E,SAAS,iBAAiB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AAe,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtE,+EAA+E;IAC/E,+EAA+E;IAC/E,0EAA0E;IAC1E,OAAO,IAAI,CAAC,YAAY,CACvB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAC1E,CAAC;AACH,CAAC"}
@@ -1,49 +1,123 @@
1
1
  /**
2
2
  * Index-nested-loop candidate construction for `rule-join-physical-selection`.
3
3
  *
4
- * When a join's inner (right) side bottoms out in a plain every-row walk over a
5
- * table whose module can answer an equality seek on the join key, the walk is
6
- * replaced by an `IndexSeekNode` whose seek keys are column references into the
7
- * OUTER row. The node above stays the logical `JoinNode`, so the existing
8
- * nested-loop emitter drives it: for each outer row it installs the outer row
9
- * slot and re-opens the inner pipeline, and the seek-key expressions resolve
10
- * through the runtime context by attribute id — the same machinery correlated
4
+ * When a join's inner side bottoms out in a table-access leaf whose module can
5
+ * answer an equality seek on the join key, the leaf is replaced by an
6
+ * `IndexSeekNode` whose seek keys are column references into the OUTER row.
7
+ * The node above stays the logical `JoinNode`, so the existing nested-loop
8
+ * emitter drives it: for each outer row it installs the outer row slot and
9
+ * re-opens the inner pipeline, and the seek-key expressions resolve through
10
+ * the runtime context by attribute id — the same machinery correlated
11
11
  * subqueries already exercise.
12
12
  *
13
13
  * Join(inner, s, SeqScan(big)) Join(inner, s, IndexSeek(big, keys=[s.k]))
14
14
  * ON big.id = s.k ──▶ ON big.id = s.k
15
15
  * reads every row of big one seek per row of s
16
16
  *
17
+ * Two admission arms for the inner leaf. A WALK leaf (plain full scan, or an
18
+ * ordering-only index walk) enforces nothing, so its `FilterInfo` may be
19
+ * replaced wholesale. A SEEK leaf (`IndexSeekNode`) already enforces the
20
+ * predicates the module claimed — `status = 'x'` below is nowhere else in the
21
+ * tree — so it is admitted by re-OFFERING those predicates to the module
22
+ * alongside the join key and re-applying whatever the module declines:
23
+ *
24
+ * Join(inner, s, IndexSeek(big, [status='x']))
25
+ * ON big.id = s.k
26
+ * ──▶ Join(inner, s, Filter[status='x'](IndexSeek(big, keys=[s.k])))
27
+ * or Join(inner, s, IndexSeek(big, keys=[status='x', s.k])) (composite index)
28
+ *
29
+ * The function takes `outer` / `inner` explicitly rather than reading a
30
+ * JoinNode's `left` / `right`: the caller asks for BOTH orientations of an
31
+ * inner join (seek the right driven by the left, and the mirror) and elects
32
+ * the cheaper — see `ruleJoinPhysicalSelection`. Here "outer" always means the
33
+ * side that will drive, and "inner" the side whose leaf becomes the seek,
34
+ * whichever JoinNode slot each came from.
35
+ *
17
36
  * This module only CONSTRUCTS the candidate (recognize the shape, probe the
18
- * module, cost it); the four-way cost comparison and the join rebuild live in
19
- * the caller. Every gate below declines by returning null, which leaves the
37
+ * module, cost it); the cost comparison and the join rebuild live in the
38
+ * caller. Every gate below declines by returning null, which leaves the
20
39
  * nested-loop / hash / merge competition unchanged.
21
40
  *
22
41
  * NOTE: one extra pair of `getBestAccessPlan` probes runs per qualifying
23
- * equi-join, uncached (see `probeModule`). Cheap for both shipped modules;
24
- * memoize by (table, seek columns) only if a third-party module with an
25
- * expensive planner shows up in optimization profiles — mirrors the
26
- * rule-key-set-seek tripwire.
42
+ * equi-join on the walk arm, uncached (see `probeModule`); the seek arm runs
43
+ * ONE probe — its baseline is the displaced seek's recorded cost, a field read
44
+ * rather than a second probe. Cheap for both shipped modules; memoize by
45
+ * (table, offered constraints) only if a third-party module with an expensive
46
+ * planner shows up in optimization profiles — mirrors the rule-key-set-seek
47
+ * tripwire.
27
48
  */
28
49
  import type { RelationalPlanNode } from '../../nodes/plan-node.js';
29
50
  import type { OptContext } from '../../framework/context.js';
30
- import { JoinNode } from '../../nodes/join-node.js';
51
+ import type { JoinType } from '../../nodes/join-node.js';
31
52
  import type { EquiJoinPair } from '../../nodes/join-utils.js';
53
+ import { type PredicateConstraint } from '../../analysis/constraint-extractor.js';
54
+ import type { TableSchema } from '../../../schema/table.js';
32
55
  export interface IndexNestedLoopCandidate {
33
- /** Rebuilt right subtree with the access leaf replaced by the correlated seek. */
34
- readonly newRight: RelationalPlanNode;
56
+ /**
57
+ * Rebuilt INNER subtree with the access leaf replaced by the correlated seek.
58
+ * Which JoinNode slot it belongs in is the caller's business — it is the
59
+ * `inner` argument's slot, which is the right one only in the un-mirrored case.
60
+ */
61
+ readonly newInner: RelationalPlanNode;
35
62
  /** Engine-currency cost, comparable with nestedLoop/hash/merge in the caller. */
36
63
  readonly cost: number;
64
+ /**
65
+ * The two inputs `cost` was derived from, so the caller can re-price the same
66
+ * seek under a different driver (`batchedIndexNestedLoopJoinCost`) without
67
+ * re-probing: the module's row estimate for one seek, and the inner
68
+ * subtree's first-row latency.
69
+ */
70
+ readonly rowsPerSeek: number;
71
+ readonly perSeekLatencyMs: number;
72
+ /**
73
+ * True when the rebuilt inner PROVABLY yields at most one row per outer row —
74
+ * see {@link provesAtMostOne}. What lets the caller drive this candidate as a
75
+ * one-branch `FanOutLookupJoinNode` (`atMostOne-*` branch), whose runtime
76
+ * throws on a second row.
77
+ */
78
+ readonly atMostOne: boolean;
37
79
  }
38
80
  /**
39
- * Try to build an index-nested-loop candidate for `node`: the right subtree
40
- * rebuilt with its access leaf replaced by a correlated `IndexSeekNode`, plus
81
+ * PROOF — not an estimate — that the inner rebuilt from `combined` yields at
82
+ * most one row per outer row. `FanOutLookupJoinNode`'s `atMostOne-*` branch
83
+ * modes throw `QuereusError(CONSTRAINT)` at runtime on a second row, so the
84
+ * module's `rows: 1` estimate must not stand in: a module that estimates 1 and
85
+ * returns 2 would turn a working query into an error.
86
+ *
87
+ * Premise: every constraint in `combined` is enforced somewhere inside the
88
+ * rebuilt inner. That is total for the `=` constraints this proof reads, by
89
+ * construction rather than by argument — each one is either module-DECLINED, and
90
+ * `reapplyDeclinedPushed` re-applies every declined pushed constraint as a Filter
91
+ * (join-key leftovers need none: the ON condition the caller keeps above the seek
92
+ * covers them), or module-HANDLED, and a handled constraint is either consumed
93
+ * into the seek's bounds or recovered by `selectPhysicalNode`'s
94
+ * `reattachUnconsumedConstraints` — whose `RECLAIMABLE_OPS` set contains `'='`,
95
+ * so no equality can fall through it. A Filter only removes rows, so a constraint
96
+ * enforced by a filter rather than by the index counts just the same. Then: if
97
+ * some enforced key has EVERY column pinned by an equality whose collation
98
+ * refines the key's ({@link equalityRefinesKey}), any two surviving rows agree
99
+ * on the whole key and uniqueness forbids the second. Ranges, IN and OR_RANGE
100
+ * admit many values and never contribute. Over-fetch is harmless — a
101
+ * `COARSER_SAFE` seek's residual Filter re-applies the exact comparison above
102
+ * it — and the finer-index case (`MISMATCH_UNSAFE`) never reaches here: it
103
+ * degrades to a scan in `selectPhysicalNode` and `rebuiltSeek` declines the
104
+ * candidate first. NULL keys need no case: `col = NULL` matches nothing.
105
+ *
106
+ * Exported for direct unit coverage; it is the correctness core of the batched
107
+ * candidate.
108
+ */
109
+ export declare function provesAtMostOne(tableSchema: TableSchema, combined: readonly PredicateConstraint[]): boolean;
110
+ /**
111
+ * Try to build an index-nested-loop candidate: the `inner` subtree rebuilt with
112
+ * its access leaf replaced by an `IndexSeekNode` correlated to `outer`, plus
41
113
  * its engine-currency cost. Returns null when any gate declines; the caller's
42
114
  * nested-loop / hash / merge competition is then unchanged.
43
115
  *
44
- * `equiPairs` must be non-empty and oriented left=outer / right=inner (as
45
- * `extractEquiPairs` produces for this join). `outerRows` is the caller's
46
- * left-side estimate — the same input hash and merge selection use.
116
+ * `joinType` is the type the REBUILT join will have with `outer` on the left
117
+ * (so a mirrored inner join passes 'inner'). `equiPairs` must be non-empty and
118
+ * oriented left=outer / right=inner — the caller flips them for the mirror.
119
+ * `outerRows` is the outer side's row estimate, the same input hash and merge
120
+ * selection use for that side.
47
121
  */
48
- export declare function tryIndexNestedLoop(node: JoinNode, equiPairs: readonly EquiJoinPair[], outerRows: number, context: OptContext): IndexNestedLoopCandidate | null;
122
+ export declare function tryIndexNestedLoop(joinType: JoinType, outer: RelationalPlanNode, inner: RelationalPlanNode, equiPairs: readonly EquiJoinPair[], outerRows: number, context: OptContext): IndexNestedLoopCandidate | null;
49
123
  //# sourceMappingURL=index-nested-loop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-nested-loop.d.ts","sourceRoot":"","sources":["../../../../../src/planner/rules/join/index-nested-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,0BAA0B,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAiB9D,MAAM,WAAW,wBAAwB;IACxC,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAuND;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,UAAU,GACjB,wBAAwB,GAAG,IAAI,CA2EjC"}
1
+ {"version":3,"file":"index-nested-loop.d.ts","sourceRoot":"","sources":["../../../../../src/planner/rules/join/index-nested-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,0BAA0B,CAAC;AACnF,OAA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