@quereus/quereus 4.22.0 → 4.23.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 (131) hide show
  1. package/dist/src/core/database-cardinality-feedback.d.ts +133 -20
  2. package/dist/src/core/database-cardinality-feedback.d.ts.map +1 -1
  3. package/dist/src/core/database-cardinality-feedback.js +312 -39
  4. package/dist/src/core/database-cardinality-feedback.js.map +1 -1
  5. package/dist/src/core/database.d.ts +1 -0
  6. package/dist/src/core/database.d.ts.map +1 -1
  7. package/dist/src/core/database.js +14 -6
  8. package/dist/src/core/database.js.map +1 -1
  9. package/dist/src/core/statement.d.ts +6 -1
  10. package/dist/src/core/statement.d.ts.map +1 -1
  11. package/dist/src/core/statement.js +11 -2
  12. package/dist/src/core/statement.js.map +1 -1
  13. package/dist/src/func/builtins/cardinality-feedback.d.ts +6 -0
  14. package/dist/src/func/builtins/cardinality-feedback.d.ts.map +1 -1
  15. package/dist/src/func/builtins/cardinality-feedback.js +55 -3
  16. package/dist/src/func/builtins/cardinality-feedback.js.map +1 -1
  17. package/dist/src/func/builtins/explain.d.ts.map +1 -1
  18. package/dist/src/func/builtins/explain.js +3 -1
  19. package/dist/src/func/builtins/explain.js.map +1 -1
  20. package/dist/src/func/builtins/index.d.ts.map +1 -1
  21. package/dist/src/func/builtins/index.js +2 -1
  22. package/dist/src/func/builtins/index.js.map +1 -1
  23. package/dist/src/index.d.ts +1 -1
  24. package/dist/src/index.d.ts.map +1 -1
  25. package/dist/src/planner/cost/index.d.ts +25 -19
  26. package/dist/src/planner/cost/index.d.ts.map +1 -1
  27. package/dist/src/planner/cost/index.js +28 -21
  28. package/dist/src/planner/cost/index.js.map +1 -1
  29. package/dist/src/planner/framework/trace.js +2 -2
  30. package/dist/src/planner/framework/trace.js.map +1 -1
  31. package/dist/src/planner/nodes/aggregate-node.d.ts +2 -1
  32. package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
  33. package/dist/src/planner/nodes/aggregate-node.js +1 -0
  34. package/dist/src/planner/nodes/aggregate-node.js.map +1 -1
  35. package/dist/src/planner/nodes/filter.d.ts.map +1 -1
  36. package/dist/src/planner/nodes/filter.js +5 -10
  37. package/dist/src/planner/nodes/filter.js.map +1 -1
  38. package/dist/src/planner/nodes/hash-aggregate.d.ts +2 -1
  39. package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
  40. package/dist/src/planner/nodes/hash-aggregate.js +1 -0
  41. package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
  42. package/dist/src/planner/nodes/plan-node.d.ts +11 -0
  43. package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
  44. package/dist/src/planner/nodes/plan-node.js +3 -0
  45. package/dist/src/planner/nodes/plan-node.js.map +1 -1
  46. package/dist/src/planner/nodes/reference.d.ts +3 -3
  47. package/dist/src/planner/nodes/reference.d.ts.map +1 -1
  48. package/dist/src/planner/nodes/reference.js +11 -5
  49. package/dist/src/planner/nodes/reference.js.map +1 -1
  50. package/dist/src/planner/nodes/stream-aggregate.d.ts +2 -1
  51. package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
  52. package/dist/src/planner/nodes/stream-aggregate.js +1 -0
  53. package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
  54. package/dist/src/planner/nodes/table-access-nodes.d.ts +14 -1
  55. package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
  56. package/dist/src/planner/nodes/table-access-nodes.js +52 -20
  57. package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
  58. package/dist/src/planner/optimizer-tuning.d.ts +38 -7
  59. package/dist/src/planner/optimizer-tuning.d.ts.map +1 -1
  60. package/dist/src/planner/optimizer-tuning.js +7 -2
  61. package/dist/src/planner/optimizer-tuning.js.map +1 -1
  62. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +9 -0
  63. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -1
  64. package/dist/src/planner/rules/access/rule-key-set-seek.js +18 -12
  65. package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -1
  66. package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
  67. package/dist/src/planner/rules/access/rule-select-access-path.js +7 -8
  68. package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
  69. package/dist/src/planner/rules/aggregate/rule-aggregate-streaming.js +1 -1
  70. package/dist/src/planner/rules/aggregate/rule-aggregate-streaming.js.map +1 -1
  71. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.d.ts.map +1 -1
  72. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js +7 -0
  73. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js.map +1 -1
  74. package/dist/src/planner/rules/join/index-nested-loop.d.ts +6 -2
  75. package/dist/src/planner/rules/join/index-nested-loop.d.ts.map +1 -1
  76. package/dist/src/planner/rules/join/index-nested-loop.js +20 -14
  77. package/dist/src/planner/rules/join/index-nested-loop.js.map +1 -1
  78. package/dist/src/planner/rules/join/rule-fanout-batched-outer.d.ts.map +1 -1
  79. package/dist/src/planner/rules/join/rule-fanout-batched-outer.js +5 -0
  80. package/dist/src/planner/rules/join/rule-fanout-batched-outer.js.map +1 -1
  81. package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
  82. package/dist/src/planner/rules/join/rule-join-physical-selection.js +102 -53
  83. package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
  84. package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts +1 -1
  85. package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
  86. package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +15 -6
  87. package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
  88. package/dist/src/planner/rules/join/rule-quickpick-enumeration.d.ts.map +1 -1
  89. package/dist/src/planner/rules/join/rule-quickpick-enumeration.js +8 -1
  90. package/dist/src/planner/rules/join/rule-quickpick-enumeration.js.map +1 -1
  91. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
  92. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +4 -3
  93. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
  94. package/dist/src/planner/stats/catalog-stats.d.ts +8 -8
  95. package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
  96. package/dist/src/planner/stats/catalog-stats.js +10 -10
  97. package/dist/src/planner/stats/catalog-stats.js.map +1 -1
  98. package/dist/src/planner/stats/table-cardinality.d.ts +119 -30
  99. package/dist/src/planner/stats/table-cardinality.d.ts.map +1 -1
  100. package/dist/src/planner/stats/table-cardinality.js +137 -29
  101. package/dist/src/planner/stats/table-cardinality.js.map +1 -1
  102. package/dist/src/planner/util/relative-rows.d.ts +29 -0
  103. package/dist/src/planner/util/relative-rows.d.ts.map +1 -0
  104. package/dist/src/planner/util/relative-rows.js +67 -0
  105. package/dist/src/planner/util/relative-rows.js.map +1 -0
  106. package/dist/src/planner/util/row-estimates.d.ts +23 -0
  107. package/dist/src/planner/util/row-estimates.d.ts.map +1 -1
  108. package/dist/src/planner/util/row-estimates.js +29 -0
  109. package/dist/src/planner/util/row-estimates.js.map +1 -1
  110. package/dist/src/runtime/cardinality-observations.d.ts +62 -7
  111. package/dist/src/runtime/cardinality-observations.d.ts.map +1 -1
  112. package/dist/src/runtime/cardinality-observations.js +74 -8
  113. package/dist/src/runtime/cardinality-observations.js.map +1 -1
  114. package/dist/src/runtime/emit/scan.d.ts +1 -1
  115. package/dist/src/runtime/emit/scan.d.ts.map +1 -1
  116. package/dist/src/runtime/emit/scan.js +78 -10
  117. package/dist/src/runtime/emit/scan.js.map +1 -1
  118. package/dist/src/schema/manager.d.ts +5 -5
  119. package/dist/src/schema/manager.d.ts.map +1 -1
  120. package/dist/src/schema/manager.js +5 -5
  121. package/dist/src/schema/manager.js.map +1 -1
  122. package/dist/src/vtab/filter-info.d.ts +16 -0
  123. package/dist/src/vtab/filter-info.d.ts.map +1 -1
  124. package/dist/src/vtab/filter-info.js +29 -0
  125. package/dist/src/vtab/filter-info.js.map +1 -1
  126. package/dist/src/vtab/memory/module.d.ts.map +1 -1
  127. package/dist/src/vtab/memory/module.js +5 -3
  128. package/dist/src/vtab/memory/module.js.map +1 -1
  129. package/dist/src/vtab/module.d.ts +53 -0
  130. package/dist/src/vtab/module.d.ts.map +1 -1
  131. package/package.json +3 -3
@@ -3,31 +3,47 @@
3
3
  *
4
4
  * One per `Database`. The planner reads it through `plannedRowCount`
5
5
  * (`planner/stats/table-cardinality.ts`), where an answering entry outranks the
6
- * catalog's `ANALYZE` count. This module owns the record policy — which
7
- * observations are worth keeping, and when one has moved far enough from what
8
- * plans were costed against to call it a *shift* — and the entries' lifetime.
6
+ * catalog's `ANALYZE` count and a module's approximate count, but not a module's
7
+ * exact one, and through `plannedRowsPerKey`, where an entry's rows per key answers
8
+ * unless the catalog's statistics cover the column set. This module owns the record
9
+ * policy — which observations are worth keeping, and when one has moved far enough
10
+ * from what plans were costed against to call it a *shift* — and the entries' lifetime.
9
11
  *
10
12
  * Validity is schema identity: an entry answers only for the exact `TableSchema`
11
13
  * object it was observed under. Any swap (`ANALYZE`, `ALTER TABLE`, drop and
12
14
  * re-create) silences it, and a schema-change listener evicts it. The identity
13
15
  * check is the correctness guard; the listener is memory hygiene.
14
16
  *
17
+ * An entry holds an exact count from a complete read, a floor ("at least N rows") from a
18
+ * partial one, or both; a floor only ever raises an estimate, and an exact count clears it.
19
+ * Beside them it keeps, per equality column set the table is seeked on through a
20
+ * non-unique index, a running mean of the rows one key matched ({@link PerKeyEntry}).
21
+ *
15
22
  * Execution feeds it through {@link CardinalityFeedbackManager.publish}, which admits
16
- * only counts of committed state: a count taken inside a transaction is held until
23
+ * only observations of committed state: one made inside a transaction is held until
17
24
  * that transaction commits ({@link CardinalityFeedbackManager.onCommitted}) and
18
25
  * dropped if it rolls back ({@link CardinalityFeedbackManager.onRolledBack}).
19
26
  *
20
27
  * A shift reaches prepared statements through `onShift`; each statement paces its
21
- * re-plans with a {@link FeedbackReplanState}.
28
+ * re-plans with a {@link FeedbackReplanState}. A module-reported size, which moves with
29
+ * no observation at all, is re-checked by each statement at execution start against the
30
+ * size its plan was costed with ({@link ReportedSizeSnapshot}).
22
31
  *
23
32
  * Nothing here is persisted: a new `Database` starts empty. See
24
33
  * docs/progressive-optimizer.md §3.2–3.6.
25
34
  */
26
35
  import { createLogger } from '../common/logger.js';
27
- import { CardinalityObservations } from '../runtime/cardinality-observations.js';
28
- import { catalogRowCount } from '../planner/stats/table-cardinality.js';
36
+ import { CardinalityObservations, columnSetKey } from '../runtime/cardinality-observations.js';
37
+ import { catalogRowCount, moduleReportsRowCount, plannedRowCount, } from '../planner/stats/table-cardinality.js';
29
38
  const log = createLogger('core:cardinality-feedback');
30
39
  const debugLog = log.extend('debug');
40
+ /**
41
+ * Samples a rows-per-key mean tracks exactly before it becomes an exponential average:
42
+ * up to this many, the mean is the exact running mean of every sample; past it, each
43
+ * sample weighs 1/32, so a changing distribution is followed rather than averaged away.
44
+ * A module constant, not a tuning knob — nothing a deployment would turn.
45
+ */
46
+ const ROWS_PER_KEY_WINDOW = 32;
31
47
  /**
32
48
  * Distance between two counts as a ratio ≥ 1. The `+ 1` on both sides keeps a zero
33
49
  * count finite and makes tiny counts compare sanely (0 vs 3 is 4×, not infinite).
@@ -42,6 +58,20 @@ export function overlayTableKey(schemaName, tableName) {
42
58
  function tableKey(table) {
43
59
  return overlayTableKey(table.schemaName, table.name);
44
60
  }
61
+ function newEntry(schema, baselineRows) {
62
+ return { schema, rows: undefined, atLeast: undefined, baselineRows, observations: 0, shifts: 0, perKey: new Map() };
63
+ }
64
+ /**
65
+ * Folds a batch of `count` samples averaging `batchMean` into `entry` (docs/progressive-optimizer.md
66
+ * §3.4): with `n` samples already held the batch weighs `min(1, count / min(n + count, WINDOW))` —
67
+ * the exact running mean up to the window, 1/32 per sample past it, and a batch at least the
68
+ * window's size replaces the mean outright.
69
+ */
70
+ function foldRowsPerKey(entry, batchMean, count) {
71
+ const weight = Math.min(1, count / Math.min(entry.samples + count, ROWS_PER_KEY_WINDOW));
72
+ entry.mean += (batchMean - entry.mean) * weight;
73
+ entry.samples += count;
74
+ }
45
75
  /** Cap on the cooldown's doubling: re-plans past the seventh wait `64 × replanCooldown` executions. */
46
76
  const MAX_COOLDOWN_DOUBLINGS = 6;
47
77
  /**
@@ -80,6 +110,68 @@ export class FeedbackReplanState {
80
110
  return cooldown * 2 ** Math.min(this.replans - 1, MAX_COOLDOWN_DOUBLINGS);
81
111
  }
82
112
  }
113
+ /**
114
+ * The planned sizes, as of one compile, of the tables the plan reads whose module reports
115
+ * its own count (docs/progressive-optimizer.md §3.6). Such a count moves on every write
116
+ * with no event the planner hears, and a plan that no longer reads the table in full
117
+ * never produces an observation, so nothing else notices that a table planned at 10 rows
118
+ * now holds a million. A prepared statement compares its snapshot with the current
119
+ * planned sizes at each execution start and treats a drift like an overlay shift.
120
+ *
121
+ * Planned sizes, not raw module answers, are compared, so an approximate count the
122
+ * overlay outranks drifts only when what planning would use drifts.
123
+ */
124
+ export class ReportedSizeSnapshot {
125
+ sizes;
126
+ static empty = new ReportedSizeSnapshot([]);
127
+ constructor(sizes) {
128
+ this.sizes = sizes;
129
+ }
130
+ /**
131
+ * Called right after a compile, in the same synchronous turn, so each size is the one
132
+ * the plan's table references were costed with. Tables whose module has no
133
+ * `getRowCount` are left out: overlay shifts and schema changes already cover them.
134
+ */
135
+ static capture(db, dependencies) {
136
+ // NOTE: write targets are kept too (dependencies do not record read vs write), so a
137
+ // prepared `insert` driving a bulk load re-plans at each 10× of its target, paced by
138
+ // the cooldown; if those re-plans ever show up in a profile, record dependency roles
139
+ // in the builder and keep only read tables here.
140
+ const sizes = [];
141
+ for (const dep of dependencies) {
142
+ if (dep.type !== 'table' || !dep.schemaName)
143
+ continue;
144
+ const table = db.schemaManager.findTable(dep.objectName, dep.schemaName);
145
+ if (table && moduleReportsRowCount(db, table))
146
+ sizes.push({ table, rows: currentPlannedRows(db, table) });
147
+ }
148
+ return sizes.length > 0 ? new ReportedSizeSnapshot(sizes) : ReportedSizeSnapshot.empty;
149
+ }
150
+ /**
151
+ * True when some table's planned size has moved `shiftFactor` from the captured one
152
+ * with the larger side above `minRows` — the overlay's shift rule (§3.4). A table whose
153
+ * catalog object was replaced is skipped: that schema change already dropped the plan.
154
+ */
155
+ drifted(db) {
156
+ if (this.sizes.length === 0)
157
+ return false;
158
+ const { shiftFactor, minRows } = db.optimizer.tuning.cardinalityFeedback;
159
+ for (const { table, rows } of this.sizes) {
160
+ if (db.schemaManager.findTable(table.name, table.schemaName) !== table)
161
+ continue;
162
+ const now = currentPlannedRows(db, table);
163
+ if (Math.max(now, rows) > minRows && rowCountSpread(now, rows) >= shiftFactor) {
164
+ debugLog('Reported size drift on %s: planned %d, now %d rows', tableKey(table), rows, now);
165
+ return true;
166
+ }
167
+ }
168
+ return false;
169
+ }
170
+ }
171
+ /** What planning would size `table` at now; an unknown size reads as `defaultRowEstimate`, as in the overlay's record policy. */
172
+ function currentPlannedRows(db, table) {
173
+ return plannedRowCount(table, db._rowCountSources) ?? db.optimizer.tuning.defaultRowEstimate;
174
+ }
83
175
  export class CardinalityFeedbackManager {
84
176
  ctx;
85
177
  /**
@@ -90,8 +182,8 @@ export class CardinalityFeedbackManager {
90
182
  entries = new Map();
91
183
  /**
92
184
  * Observations made inside the open transaction, held until it ends; same key as
93
- * `entries`, last count per table wins. Bounded by the distinct tables one
94
- * transaction observes.
185
+ * `entries`, last count and largest floor per table win. Bounded by the distinct
186
+ * tables one transaction observes.
95
187
  */
96
188
  pending = new Map();
97
189
  /** {@link onRolledBack} calls so far; each execution's sink records it at start. */
@@ -107,40 +199,114 @@ export class CardinalityFeedbackManager {
107
199
  if (!entry || entry.schema !== table)
108
200
  return undefined;
109
201
  this.touch(key, entry);
110
- return entry.rows;
202
+ return entry;
203
+ }
204
+ /** The running mean for `columns` on `table`, under the same identity rule as {@link observedRows}; a hit refreshes the table's recency. */
205
+ observedRowsPerKey(table, columns) {
206
+ const key = tableKey(table);
207
+ const entry = this.entries.get(key);
208
+ if (!entry || entry.schema !== table)
209
+ return undefined;
210
+ const keyEntry = entry.perKey.get(columnSetKey(columns));
211
+ if (!keyEntry)
212
+ return undefined;
213
+ this.touch(key, entry);
214
+ return keyEntry.mean;
111
215
  }
112
216
  /**
113
217
  * Offer one exact row count of `table`, observed by a complete enumeration of
114
218
  * committed state. Applies the record policy (docs/progressive-optimizer.md §3.4):
115
219
  * ignored when the schema object is superseded or when both the observation and the
116
- * current estimate are small; otherwise recorded, and reported through `onShift`
117
- * when it has moved `shiftFactor` from the entry's baseline.
220
+ * current estimate are small; otherwise recorded — clearing any floor, which the newer
221
+ * complete count supersedes — and reported through `onShift` when it has moved
222
+ * `shiftFactor` from the entry's baseline.
118
223
  */
119
224
  record(table, rows) {
120
- if (this.ctx.schemaManager.findTable(table.name, table.schemaName) !== table) {
121
- debugLog('Ignored %d rows for %s.%s: observed under a superseded schema', rows, table.schemaName, table.name);
225
+ if (this.isSuperseded(table))
122
226
  return;
123
- }
124
- const tuning = this.ctx.getTuning();
125
- const policy = tuning.cardinalityFeedback;
227
+ const policy = this.ctx.getTuning().cardinalityFeedback;
126
228
  const key = tableKey(table);
127
229
  const existing = this.validEntry(key, table);
128
- const before = existing?.rows ?? catalogRowCount(table) ?? tuning.defaultRowEstimate;
230
+ // NOTE: an exactly module-sized table still records an entry, which `plannedRowCount`
231
+ // never reads while the module answers — one LRU slot each; if `maxTables` pressure
232
+ // ever matters, skip recording when the module's count is exact.
233
+ const before = this.plannedBefore(table, existing);
129
234
  if (Math.max(before, rows) <= policy.minRows)
130
235
  return;
131
- const entry = existing ?? { schema: table, rows, baselineRows: before, observations: 0, shifts: 0 };
236
+ const entry = this.upsert(key, existing ?? newEntry(table, before));
132
237
  entry.rows = rows;
133
- entry.observations++;
134
- this.touch(key, entry);
135
- this.evictBeyond(policy.maxTables);
136
- const shifted = rowCountSpread(rows, entry.baselineRows) >= policy.shiftFactor;
137
- debugLog('Recorded %d rows for %s (was %d, baseline %d)%s', rows, key, before, entry.baselineRows, shifted ? ' — shift' : '');
138
- if (!shifted)
238
+ entry.atLeast = undefined;
239
+ debugLog('Recorded %d rows for %s (was %d, baseline %d)', rows, key, before, entry.baselineRows);
240
+ this.shiftIfMoved(key, entry, rows);
241
+ }
242
+ /**
243
+ * Offer one floor for `table`: a read of committed state yielded `rows` distinct rows of
244
+ * it, so it holds at least that many (docs/progressive-optimizer.md §3.4). Recorded only
245
+ * when it exceeds both what planning would use now and `minRows`, so a floor never
246
+ * lowers an estimate and never makes an unknown table look smaller than the default it
247
+ * plans at today. Shifts like a count; floors only raise, so they cannot oscillate.
248
+ */
249
+ recordAtLeast(table, rows) {
250
+ if (this.isSuperseded(table))
139
251
  return;
140
- log('Shift on %s: baseline %d -> %d rows', key, entry.baselineRows, rows);
141
- entry.baselineRows = rows;
142
- entry.shifts++;
143
- this.ctx.onShift(key);
252
+ const policy = this.ctx.getTuning().cardinalityFeedback;
253
+ const key = tableKey(table);
254
+ const existing = this.validEntry(key, table);
255
+ const before = this.plannedBefore(table, existing);
256
+ if (rows <= before || rows <= policy.minRows)
257
+ return;
258
+ const entry = this.upsert(key, existing ?? newEntry(table, before));
259
+ entry.atLeast = Math.max(entry.atLeast ?? 0, rows);
260
+ debugLog('Recorded at least %d rows for %s (was %d, baseline %d)', rows, key, before, entry.baselineRows);
261
+ this.shiftIfMoved(key, entry, rows);
262
+ }
263
+ /**
264
+ * Offer `count` samples of rows per key for `spec`'s column set on `table`, summing to
265
+ * `sum` rows — one sample per exhausted equality seek with non-NULL keys
266
+ * (docs/progressive-optimizer.md §3.4). Ignored under a superseded schema, and unless
267
+ * the table's planned size exceeds `minRows`: below that every plan finishes fast, and
268
+ * the gate keeps small-table plans unchanged exactly as the count gate does. So a table
269
+ * of unknown size learns rows per key only once its size is learned (a complete scan,
270
+ * a floor, or a module count above the gate); publication applies per-key batches
271
+ * after the same execution's counts and floors, so one execution can open the gate for
272
+ * itself. A new column-set entry's baseline is the rows per key the plan was priced
273
+ * with; the table remembers at most `maxKeySetsPerTable` sets, least recently recorded
274
+ * evicted. Accepted bias: frequently probed keys weigh more than a uniform sample would.
275
+ * Reported through `onShift` under the table's key when the folded mean has moved
276
+ * `shiftFactor` from the set's baseline — the count rule, applied to the mean.
277
+ */
278
+ recordRowsPerKey(table, spec, sum, count) {
279
+ if (count <= 0 || this.isSuperseded(table))
280
+ return;
281
+ const policy = this.ctx.getTuning().cardinalityFeedback;
282
+ const key = tableKey(table);
283
+ const existing = this.validEntry(key, table);
284
+ const before = this.plannedBefore(table, existing);
285
+ if (before <= policy.minRows)
286
+ return;
287
+ // NOTE: a set the catalog's statistics cover is recorded too, though `plannedRowsPerKey`
288
+ // never consults it under this schema object (an `ANALYZE` swaps the object before
289
+ // coverage can change), so under a stale catalog its first record can shift once and
290
+ // re-plan statements that land the same plan; if that re-plan ever shows in a profile,
291
+ // skip the record when `catalogCoversColumns` holds.
292
+ const entry = this.upsert(key, existing ?? newEntry(table, before));
293
+ const batchMean = sum / count;
294
+ let keyEntry = entry.perKey.get(spec.key);
295
+ if (keyEntry) {
296
+ entry.perKey.delete(spec.key);
297
+ foldRowsPerKey(keyEntry, batchMean, count);
298
+ }
299
+ else {
300
+ keyEntry = { columns: spec.columns, mean: batchMean, samples: count, baseline: spec.plannedRowsPerKey, shifts: 0 };
301
+ }
302
+ entry.perKey.set(spec.key, keyEntry);
303
+ for (const staleKey of entry.perKey.keys()) {
304
+ if (entry.perKey.size <= policy.maxKeySetsPerTable)
305
+ break;
306
+ entry.perKey.delete(staleKey);
307
+ }
308
+ debugLog('Recorded %d rows per key over %d samples for %s (%s) (mean now %d, baseline %d)', batchMean, count, key, spec.key, keyEntry.mean, keyEntry.baseline);
309
+ this.shiftIfRowsPerKeyMoved(key, spec.key, keyEntry);
144
310
  }
145
311
  /**
146
312
  * Offer one finished execution's observations (docs/progressive-optimizer.md §3.5).
@@ -162,19 +328,20 @@ export class CardinalityFeedbackManager {
162
328
  this.recordAll(observations);
163
329
  }
164
330
  else {
165
- for (const [table, rows] of observations.entries()) {
166
- this.pending.set(tableKey(table), { table, rows });
167
- }
331
+ this.holdAll(observations);
168
332
  }
169
333
  }
170
- /** A fresh per-execution sink, stamped so {@link publish} can tell whether a rollback ran under it. */
334
+ /**
335
+ * A fresh per-execution sink, stamped so {@link publish} can tell whether a rollback ran
336
+ * under it, and carrying the record floor so it can drop floors that could never record.
337
+ */
171
338
  beginObservations() {
172
- return new CardinalityObservations(this.rollbacks);
339
+ return new CardinalityObservations(this.rollbacks, this.ctx.getTuning().cardinalityFeedback.minRows);
173
340
  }
174
341
  /**
175
342
  * The open transaction committed: record what it held, except tables it wrote.
176
- * Such a count was taken mid-transaction, possibly before later writes in the same
177
- * transaction, and the change log cannot say which came first. `changedCounts` is
343
+ * Such an observation was made mid-transaction, possibly before later writes in the
344
+ * same transaction, and the change log cannot say which came first. `changedCounts` is
178
345
  * the change log keyed like `entries` — every table the transaction wrote, even one
179
346
  * whose writes cancelled out — and is not built when nothing is held.
180
347
  */
@@ -186,12 +353,12 @@ export class CardinalityFeedbackManager {
186
353
  return;
187
354
  try {
188
355
  const changed = changedCounts();
189
- for (const [key, { table, rows }] of this.pending) {
356
+ for (const [key, held] of this.pending) {
190
357
  if (changed.has(key)) {
191
- debugLog('Dropped %d rows for %s: the committing transaction wrote it', rows, key);
358
+ debugLog('Dropped observations of %s: the committing transaction wrote it', key);
192
359
  continue;
193
360
  }
194
- this.record(table, rows);
361
+ this.recordHeld(held);
195
362
  }
196
363
  }
197
364
  finally {
@@ -219,10 +386,18 @@ export class CardinalityFeedbackManager {
219
386
  schemaName: schema.schemaName,
220
387
  tableName: schema.name,
221
388
  rows: entry.rows,
389
+ atLeast: entry.atLeast,
222
390
  catalogRows: catalogRowCount(schema),
223
391
  baselineRows: entry.baselineRows,
224
392
  observations: entry.observations,
225
393
  shifts: entry.shifts,
394
+ perKey: [...entry.perKey.values()].map(keyEntry => ({
395
+ keyColumns: keyEntry.columns.map(i => schema.columns[i].name),
396
+ rowsPerKey: keyEntry.mean,
397
+ samples: keyEntry.samples,
398
+ baselineRowsPerKey: keyEntry.baseline,
399
+ shifts: keyEntry.shifts,
400
+ })),
226
401
  });
227
402
  }
228
403
  return out;
@@ -245,10 +420,108 @@ export class CardinalityFeedbackManager {
245
420
  }
246
421
  });
247
422
  }
423
+ /**
424
+ * Exact counts first: a floor at or below the count just recorded is then ignored.
425
+ * Rows per key last, so a count or floor from the same execution can open its table-size gate.
426
+ */
248
427
  recordAll(observations) {
249
428
  for (const [table, rows] of observations.entries()) {
250
429
  this.record(table, rows);
251
430
  }
431
+ for (const [table, rows] of observations.lowerBounds()) {
432
+ this.recordAtLeast(table, rows);
433
+ }
434
+ for (const [table, { spec, sum, count }] of observations.rowsPerKey()) {
435
+ this.recordRowsPerKey(table, spec, sum, count);
436
+ }
437
+ }
438
+ holdAll(observations) {
439
+ for (const [table, rows] of observations.entries()) {
440
+ this.held(table).rows = rows;
441
+ }
442
+ for (const [table, rows] of observations.lowerBounds()) {
443
+ const held = this.held(table);
444
+ held.atLeast = Math.max(held.atLeast ?? 0, rows);
445
+ }
446
+ for (const [table, { spec, sum, count }] of observations.rowsPerKey()) {
447
+ const held = this.held(table).perKey;
448
+ const heldSamples = held.get(spec.key);
449
+ if (heldSamples) {
450
+ heldSamples.sum += sum;
451
+ heldSamples.count += count;
452
+ }
453
+ else {
454
+ held.set(spec.key, { spec, sum, count });
455
+ }
456
+ }
457
+ }
458
+ /** What is held for `table`; anything held under an older schema object for its name is superseded. */
459
+ held(table) {
460
+ const key = tableKey(table);
461
+ const existing = this.pending.get(key);
462
+ if (existing?.table === table)
463
+ return existing;
464
+ const fresh = { table, rows: undefined, atLeast: undefined, perKey: new Map() };
465
+ this.pending.set(key, fresh);
466
+ return fresh;
467
+ }
468
+ /** As {@link recordAll}: the count first, so a floor it already covers is ignored, and rows per key last. */
469
+ recordHeld({ table, rows, atLeast, perKey }) {
470
+ if (rows !== undefined)
471
+ this.record(table, rows);
472
+ if (atLeast !== undefined)
473
+ this.recordAtLeast(table, atLeast);
474
+ for (const { spec, sum, count } of perKey.values())
475
+ this.recordRowsPerKey(table, spec, sum, count);
476
+ }
477
+ isSuperseded(table) {
478
+ if (this.ctx.schemaManager.findTable(table.name, table.schemaName) === table)
479
+ return false;
480
+ debugLog('Ignored an observation of %s.%s: made under a superseded schema', table.schemaName, table.name);
481
+ return true;
482
+ }
483
+ /**
484
+ * What planning would use for `table` right now — `existing` ranked with the module's
485
+ * count and the catalog's (§3.3), else the default — so an exactly module-sized table
486
+ * compares against the module and a scan agreeing with it shifts nothing.
487
+ */
488
+ plannedBefore(table, existing) {
489
+ return plannedRowCount(table, {
490
+ observedRows: () => existing,
491
+ reportedRows: t => this.ctx.reportedRows(t),
492
+ }) ?? this.ctx.getTuning().defaultRowEstimate;
493
+ }
494
+ /** Counts one recorded observation on `entry`, makes it the most recent, and enforces the cap. */
495
+ upsert(key, entry) {
496
+ entry.observations++;
497
+ this.touch(key, entry);
498
+ this.evictBeyond(this.ctx.getTuning().cardinalityFeedback.maxTables);
499
+ return entry;
500
+ }
501
+ /** Reports a shift through `onShift` when `rows` has moved `shiftFactor` from the entry's baseline. */
502
+ shiftIfMoved(key, entry, rows) {
503
+ if (rowCountSpread(rows, entry.baselineRows) < this.ctx.getTuning().cardinalityFeedback.shiftFactor)
504
+ return;
505
+ log('Shift on %s: baseline %d -> %d rows', key, entry.baselineRows, rows);
506
+ entry.baselineRows = rows;
507
+ entry.shifts++;
508
+ this.ctx.onShift(key);
509
+ }
510
+ /**
511
+ * Reports a shift through `onShift` when a column set's mean has moved `shiftFactor`
512
+ * from its baseline. The table key is reported, not the set: a statement that reads the
513
+ * table re-plans and every seek node in it re-snapshots the overlay (§3.6). A set's first
514
+ * record cannot shift when its plan was already priced from the mean (the baseline is what
515
+ * the plan used); a set re-created after eviction carries the module's estimate again and
516
+ * may shift once, landing the same plan.
517
+ */
518
+ shiftIfRowsPerKeyMoved(key, setKey, keyEntry) {
519
+ if (rowCountSpread(keyEntry.mean, keyEntry.baseline) < this.ctx.getTuning().cardinalityFeedback.shiftFactor)
520
+ return;
521
+ log('Shift on %s (%s): rows per key baseline %d -> %d', key, setKey, keyEntry.baseline, keyEntry.mean);
522
+ keyEntry.baseline = keyEntry.mean;
523
+ keyEntry.shifts++;
524
+ this.ctx.onShift(key);
252
525
  }
253
526
  /** The entry under `key` if it was observed against `table`; a stale one is replaced on record. */
254
527
  validEntry(key, table) {
@@ -1 +1 @@
1
- {"version":3,"file":"database-cardinality-feedback.js","sourceRoot":"","sources":["../../../src/core/database-cardinality-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,eAAe,EAA0B,MAAM,uCAAuC,CAAC;AAKhG,MAAM,GAAG,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAC;AACtD,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAwCrC;;;GAGG;AACH,SAAS,cAAc,CAAC,CAAS,EAAE,CAAS;IAC3C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,SAAiB;IACpE,OAAO,GAAG,UAAU,IAAI,SAAS,EAAE,CAAC,WAAW,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAkB;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,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,IAAI,KAAK,gBAAgB,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;gBACvE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAChD,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,YAAqC;QACtD,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,mGAAmG;IAC3F,UAAU,CAAC,GAAW,EAAE,KAAkB;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAEO,KAAK,CAAC,GAAW,EAAE,KAAoB;QAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,SAAiB;QACpC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,SAAS;gBAAE,OAAO;YAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;CACD"}
1
+ {"version":3,"file":"database-cardinality-feedback.js","sourceRoot":"","sources":["../../../src/core/database-cardinality-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAEO,KAAK,CAAC,GAAW,EAAE,KAAoB;QAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,SAAiB;QACpC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,SAAS;gBAAE,OAAO;YAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;CACD"}
@@ -112,6 +112,7 @@ export declare class Database implements TransactionManagerContext, AssertionEva
112
112
  private readonly autoAnalyzeManager;
113
113
  /** Observed row-count overlay — exact table sizes seen during execution */
114
114
  private readonly cardinalityFeedbackManager;
115
+ private readonly rowCountSources;
115
116
  /** Per-database collation registry — comparator + optional key normalizer +
116
117
  * optional REPLICABLE and ORDER-PRESERVING assertions. The normalizer is required
117
118
  * for index participation; comparator-only collations may still be used in ORDER BY
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/core/database.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxJ,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAA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AAsH;IACtH,OAAO,CAAC,oBAAoB;IAkC5B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACU,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACU,wBAAwB,CACpC,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,OAAO,CAAC,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC;IA0BvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACU,2BAA2B,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAwHhG"}
@@ -28,6 +28,7 @@ import { serializePlanTree, formatPlanTree } from '../planner/debug.js';
28
28
  import { EmissionContext } from '../runtime/emission-context.js';
29
29
  import { Optimizer, DEFAULT_TUNING } from '../planner/optimizer.js';
30
30
  import { CatalogStatsProvider } from '../planner/stats/catalog-stats.js';
31
+ import { databaseRowCountSources } from '../planner/stats/table-cardinality.js';
31
32
  import { registerBuiltinWindowFunctions } from '../func/builtins/builtin-window-functions.js';
32
33
  import { DatabaseOptionsManager } from './database-options.js';
33
34
  import { MAINTENANCE_REBUILD_ROW_THRESHOLD } from '../planner/cost/index.js';
@@ -141,6 +142,7 @@ export class Database {
141
142
  autoAnalyzeManager;
142
143
  /** Observed row-count overlay — exact table sizes seen during execution */
143
144
  cardinalityFeedbackManager;
145
+ rowCountSources;
144
146
  /** Per-database collation registry — comparator + optional key normalizer +
145
147
  * optional REPLICABLE and ORDER-PRESERVING assertions. The normalizer is required
146
148
  * for index participation; comparator-only collations may still be used in ORDER BY
@@ -191,15 +193,17 @@ export class Database {
191
193
  // Register built-in window functions
192
194
  registerBuiltinWindowFunctions();
193
195
  registerEmitters();
194
- // The overlay is constructed before the optimizer so the stats provider and
195
- // `TableReferenceNode` (via `SchemaManager.getObservedRowCounts`) read one object.
196
+ // The row-count sources are constructed before the optimizer so the stats provider
197
+ // and `TableReferenceNode` (via `SchemaManager.getRowCountSources`) read one object.
196
198
  this.cardinalityFeedbackManager = new CardinalityFeedbackManager({
197
199
  schemaManager: this.schemaManager,
198
200
  getTuning: () => this.optimizer.tuning,
199
201
  getAutocommit: () => this.transactionManager.getAutocommit(),
202
+ reportedRows: table => this.rowCountSources.reportedRows(table),
200
203
  onShift: key => this.noteCardinalityShift(key),
201
204
  });
202
- this.optimizer = new Optimizer(DEFAULT_TUNING, new CatalogStatsProvider(undefined, this.cardinalityFeedbackManager));
205
+ this.rowCountSources = databaseRowCountSources(this, this.cardinalityFeedbackManager);
206
+ this.optimizer = new Optimizer(DEFAULT_TUNING, new CatalogStatsProvider(undefined, this.rowCountSources));
203
207
  // Initialize transaction manager and assertion evaluator
204
208
  this.transactionManager = new TransactionManager(this);
205
209
  this.assertionEvaluator = new AssertionEvaluator(this);
@@ -410,9 +414,9 @@ export class Database {
410
414
  this.options.registerOption('cardinality_feedback', {
411
415
  type: 'boolean',
412
416
  defaultValue: true,
413
- description: 'Remember the exact row count of any table a query happens to read in full, and plan ' +
414
- 'later statements against it in place of a default or outdated statistics. Turning it off ' +
415
- 'forgets every remembered count.',
417
+ description: 'Remember the exact row count of any table a query happens to read in full, and the ' +
418
+ 'rows per key of equality lookups through non-unique indexes, and plan later statements ' +
419
+ 'against them in place of a default or outdated statistics. Turning it off forgets everything remembered.',
416
420
  onChange: (event) => {
417
421
  if (!event.newValue)
418
422
  this.cardinalityFeedbackManager.clear();
@@ -2601,6 +2605,10 @@ export class Database {
2601
2605
  get _cardinalityFeedback() {
2602
2606
  return this.cardinalityFeedbackManager;
2603
2607
  }
2608
+ /** @internal Every source the planner ranks for a base table's size (`plannedRowCount`). */
2609
+ get _rowCountSources() {
2610
+ return this.rowCountSources;
2611
+ }
2604
2612
  /** Tells every live prepared statement that `key`'s observed size shifted; each decides whether its plan reads it. */
2605
2613
  noteCardinalityShift(key) {
2606
2614
  for (const stmt of this.statements)