@quereus/store 4.12.1 → 4.13.1

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 (35) hide show
  1. package/README.md +30 -0
  2. package/dist/src/common/cost-profile.d.ts +85 -0
  3. package/dist/src/common/cost-profile.d.ts.map +1 -0
  4. package/dist/src/common/cost-profile.js +56 -0
  5. package/dist/src/common/cost-profile.js.map +1 -0
  6. package/dist/src/common/index.d.ts +2 -1
  7. package/dist/src/common/index.d.ts.map +1 -1
  8. package/dist/src/common/index.js +3 -1
  9. package/dist/src/common/index.js.map +1 -1
  10. package/dist/src/common/kv-store.d.ts +16 -0
  11. package/dist/src/common/kv-store.d.ts.map +1 -1
  12. package/dist/src/common/kv-store.js.map +1 -1
  13. package/dist/src/common/serialization.d.ts +62 -3
  14. package/dist/src/common/serialization.d.ts.map +1 -1
  15. package/dist/src/common/serialization.js +67 -3
  16. package/dist/src/common/serialization.js.map +1 -1
  17. package/dist/src/common/store-module-access-plan.d.ts +6 -1
  18. package/dist/src/common/store-module-access-plan.d.ts.map +1 -1
  19. package/dist/src/common/store-module-access-plan.js +357 -136
  20. package/dist/src/common/store-module-access-plan.js.map +1 -1
  21. package/dist/src/common/store-module-base.d.ts +13 -0
  22. package/dist/src/common/store-module-base.d.ts.map +1 -1
  23. package/dist/src/common/store-module-base.js +14 -0
  24. package/dist/src/common/store-module-base.js.map +1 -1
  25. package/dist/src/common/store-module-schema-sync.d.ts.map +1 -1
  26. package/dist/src/common/store-module-schema-sync.js +21 -0
  27. package/dist/src/common/store-module-schema-sync.js.map +1 -1
  28. package/dist/src/common/store-module.d.ts.map +1 -1
  29. package/dist/src/common/store-module.js +1 -1
  30. package/dist/src/common/store-module.js.map +1 -1
  31. package/dist/src/common/store-table-base.d.ts +88 -7
  32. package/dist/src/common/store-table-base.d.ts.map +1 -1
  33. package/dist/src/common/store-table-base.js +135 -17
  34. package/dist/src/common/store-table-base.js.map +1 -1
  35. package/package.json +5 -5
package/README.md CHANGED
@@ -98,6 +98,36 @@ than per-query, and today it only fires where the guess is the whole table. Mult
98
98
  exempt from the comparison — the engine reads their cost as a curve to decide its own key-set
99
99
  rewrites, and answering it with a scan would switch that feature off.
100
100
 
101
+ **Backend cost profile.** How expensive those reads actually are depends on the backend: a
102
+ point read is nearly free on LevelDB (in-process, block-cached) and is a separate request
103
+ across an IPC boundary on IndexedDB. A provider can therefore declare a `costProfile`
104
+ (`KVCostProfile`, in `src/common/cost-profile.ts`), whose unit is **one row read
105
+ sequentially during a full scan = 1.0**:
106
+
107
+ | knob | what it prices | parity default | declared by IndexedDB |
108
+ |---|---|---|---|
109
+ | `pointRead` | resolving one secondary-index entry to the row it names | 1.0 | 3.0 |
110
+ | `seekPositioning` | one key of a multi-seek — positioning the window *and* reading its row | 0.5 | 5.0 |
111
+
112
+ Both fields are optional and an omitted field takes its parity default, which reproduces the
113
+ module's pre-profile constants exactly — **a provider that declares nothing plans exactly as
114
+ it always did.** A field declared non-finite or non-positive falls back to its parity value
115
+ with a warning rather than breaking planning. Only LevelDB's numbers are unmeasured (it
116
+ declares nothing, deliberately); IndexedDB's come from the benchmark in
117
+ `packages/quereus-plugin-indexeddb/bench/README.md`. The profile is expressed as a *ratio*,
118
+ not milliseconds, because these costs are request-latency dominated — a slower device scales
119
+ the seek path and the scan baseline together.
120
+
121
+ `seekPositioning` is the knob that moves plan choice today: it is what the engine's key-set
122
+ rewrite reads when it interpolates the key count at which a seek overtakes the plan it would
123
+ displace, so an expensive-seek backend stops firing that rewrite on small tables.
124
+ `pointRead` changes what an index arm *advertises* and how two indexes rank against each
125
+ other — but **the seek-vs-scan comparison above is deliberately still priced at the parity
126
+ 1.0.** Because the match-count guess is a fixed fraction of the table, that comparison is
127
+ arm-disabling rather than arm-tuning: past `pointRead` 2.83 the range arm would be switched
128
+ off for every query on every table, off a guess no measurement can resolve. When real
129
+ per-column statistics replace the guess, the comparison will use the declared cost instead.
130
+
101
131
  **`IN`-list index seeks ("multi-seek").** An `IN`-list on an indexed column
102
132
  (`where v in (1, 2, 3)`, including parameter-bound lists) is served from the index as one
103
133
  deduplicated, key-ordered point seek per distinct list value, instead of a full scan with
@@ -0,0 +1,85 @@
1
+ /**
2
+ * What a storage backend's basic read operations cost, declared by the provider and
3
+ * consumed by store access planning (`store-module-access-plan.ts`).
4
+ *
5
+ * The store framework already lets a provider declare things about itself that the
6
+ * layers above must adapt to — `beginAtomicBatch`, `readCommittedSnapshot`,
7
+ * `concurrencyMode`. Cost belongs on that list: the same index seek that is nearly free
8
+ * on LevelDB (block cache, in-process reads) is a separate request across a browser IPC
9
+ * boundary on IndexedDB, and pricing both at one number makes the planner wrong for one
10
+ * of them.
11
+ */
12
+ /**
13
+ * What one storage backend's basic operations cost, RELATIVE to reading one row
14
+ * sequentially during a full scan (which is 1.0 by definition — the unit
15
+ * `AccessPlanBuilder.fullScan` charges per row).
16
+ *
17
+ * Every field is optional; an omitted field takes the parity default
18
+ * ({@link PARITY_COST_PROFILE}), which reproduces the module's pre-profile constants
19
+ * exactly. A provider that declares nothing plans byte-identically to before.
20
+ *
21
+ * A ratio rather than milliseconds, deliberately: these numbers are request-latency
22
+ * dominated, so a slower device scales both the seek path AND the scan baseline
23
+ * together and the ratio survives. A wall-clock declaration would be wrong on every
24
+ * device but the one it was measured on.
25
+ *
26
+ * NOTE: there is deliberately no third `entryRead` knob for reading an index ENTRY.
27
+ * That per-row term is the ENGINE's — `AccessPlanBuilder.eqMatch` charges `rows * 0.3`
28
+ * and `.rangeScan` charges `rows * 0.5`, both internal to the builder and shared with
29
+ * the memory module — so scaling it from here means either restating the builder's
30
+ * formula in the store (exactly the drift `AccessPlanBuilder.addCost` exists to
31
+ * prevent) or growing a new builder surface, for a term the IndexedDB benchmark puts at
32
+ * 0.8× a data row, i.e. within noise of parity. If a backend ever shows index-entry
33
+ * reads pricing very differently from data rows, add `entryRead` here AND give
34
+ * `AccessPlanBuilder` a per-row-entry hook — do not restate its formula in this package.
35
+ */
36
+ export interface KVCostProfile {
37
+ /**
38
+ * Resolving ONE secondary-index entry to the row it names — a random point read of
39
+ * the data store, batched through `getMany` (`StoreTableScan` pages at
40
+ * `ROW_RESOLUTION_BATCH`). Default 1.0.
41
+ *
42
+ * Priced by the three single-window index arms (`eq`, `prefixRange`, `range`), which
43
+ * pay it once per row they expect to return, on top of the `AccessPlanBuilder`
44
+ * shape's own per-row index-entry term.
45
+ */
46
+ readonly pointRead?: number;
47
+ /**
48
+ * The per-seek-key cost of a multi-seek: positioning one index window AND reading the
49
+ * row(s) it names. It is a WHOLE-key cost, not just the positioning half, because the
50
+ * multi-seek arms deliberately charge no separate per-row resolution (the reason is
51
+ * recorded at those arms in `store-module-access-plan.ts`). Default 0.5.
52
+ *
53
+ * This is the knob that actually moves plan CHOICE today: the engine's
54
+ * `rule-key-set-seek` probes the module at 2 and 1000 seek keys, fits a line, and
55
+ * solves for the key count at which a seek overtakes the plan it would displace. With
56
+ * the store's multi-seek cost `k·S + 0.3·min(N, k·0.1N)` against a scan baseline of
57
+ * `N` rows, the break-even lands at roughly `N/(2S)`.
58
+ */
59
+ readonly seekPositioning?: number;
60
+ }
61
+ /** A {@link KVCostProfile} with every field filled in — what the planner actually reads. */
62
+ export type ResolvedCostProfile = Required<KVCostProfile>;
63
+ /**
64
+ * The module's pre-profile constants, and the default for any backend that declares
65
+ * nothing. `pointRead: 1.0` says a resolved row costs about what a sequentially-iterated
66
+ * row costs (true for an in-process, block-cached backend, where the index path simply
67
+ * pays the row read ON TOP OF the entry read); `seekPositioning: 0.5` says positioning
68
+ * one seek key costs half a sequentially scanned row.
69
+ *
70
+ * Also the price the seek-vs-scan veto uses regardless of what a provider declares —
71
+ * see the veto site in `store-module-access-plan.ts`.
72
+ */
73
+ export declare const PARITY_COST_PROFILE: ResolvedCostProfile;
74
+ /**
75
+ * Fill in the parity defaults for whatever a provider left undeclared, replacing any
76
+ * non-finite or non-positive field with its parity value.
77
+ *
78
+ * `costProfile` is an optional member of a PUBLIC interface, so a third-party provider
79
+ * can declare anything at all. A bad declaration must not break planning (hence the
80
+ * per-field fallback rather than a throw) and must not pass silently either (hence the
81
+ * warning) — a `NaN` cost would propagate into every comparison this module makes and
82
+ * turn every `<` into `false`.
83
+ */
84
+ export declare function resolveCostProfile(profile: KVCostProfile | undefined): ResolvedCostProfile;
85
+ //# sourceMappingURL=cost-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-profile.d.ts","sourceRoot":"","sources":["../../../src/common/cost-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,4FAA4F;AAC5F,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAE1D;;;;;;;;;GASG;AAIH,eAAO,MAAM,mBAAmB,EAAE,mBAA6E,CAAC;AAEhH;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,mBAAmB,CAM1F"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * What a storage backend's basic read operations cost, declared by the provider and
3
+ * consumed by store access planning (`store-module-access-plan.ts`).
4
+ *
5
+ * The store framework already lets a provider declare things about itself that the
6
+ * layers above must adapt to — `beginAtomicBatch`, `readCommittedSnapshot`,
7
+ * `concurrencyMode`. Cost belongs on that list: the same index seek that is nearly free
8
+ * on LevelDB (block cache, in-process reads) is a separate request across a browser IPC
9
+ * boundary on IndexedDB, and pricing both at one number makes the planner wrong for one
10
+ * of them.
11
+ */
12
+ /**
13
+ * The module's pre-profile constants, and the default for any backend that declares
14
+ * nothing. `pointRead: 1.0` says a resolved row costs about what a sequentially-iterated
15
+ * row costs (true for an in-process, block-cached backend, where the index path simply
16
+ * pays the row read ON TOP OF the entry read); `seekPositioning: 0.5` says positioning
17
+ * one seek key costs half a sequentially scanned row.
18
+ *
19
+ * Also the price the seek-vs-scan veto uses regardless of what a provider declares —
20
+ * see the veto site in `store-module-access-plan.ts`.
21
+ */
22
+ // Frozen because {@link resolveCostProfile} returns this very object (not a copy) for the
23
+ // undeclared case, so every parity-backend module in the process shares one instance — and
24
+ // it is a public export, reachable from JS that the interface's `readonly` cannot stop.
25
+ export const PARITY_COST_PROFILE = Object.freeze({ pointRead: 1.0, seekPositioning: 0.5 });
26
+ /**
27
+ * Fill in the parity defaults for whatever a provider left undeclared, replacing any
28
+ * non-finite or non-positive field with its parity value.
29
+ *
30
+ * `costProfile` is an optional member of a PUBLIC interface, so a third-party provider
31
+ * can declare anything at all. A bad declaration must not break planning (hence the
32
+ * per-field fallback rather than a throw) and must not pass silently either (hence the
33
+ * warning) — a `NaN` cost would propagate into every comparison this module makes and
34
+ * turn every `<` into `false`.
35
+ */
36
+ export function resolveCostProfile(profile) {
37
+ if (!profile)
38
+ return PARITY_COST_PROFILE;
39
+ return {
40
+ pointRead: resolveCostField(profile.pointRead, 'pointRead'),
41
+ seekPositioning: resolveCostField(profile.seekPositioning, 'seekPositioning'),
42
+ };
43
+ }
44
+ /** One field's declared value, or its parity default when absent or unusable. */
45
+ function resolveCostField(declared, field) {
46
+ const parity = PARITY_COST_PROFILE[field];
47
+ if (declared === undefined)
48
+ return parity;
49
+ if (!Number.isFinite(declared) || declared <= 0) {
50
+ console.warn(`[StoreModule] provider cost profile declares an unusable ${field} (${declared}); `
51
+ + `falling back to the parity default ${parity}`);
52
+ return parity;
53
+ }
54
+ return declared;
55
+ }
56
+ //# sourceMappingURL=cost-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-profile.js","sourceRoot":"","sources":["../../../src/common/cost-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwDH;;;;;;;;;GASG;AACH,0FAA0F;AAC1F,2FAA2F;AAC3F,wFAAwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAwB,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;AAEhH;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACpE,IAAI,CAAC,OAAO;QAAE,OAAO,mBAAmB,CAAC;IACzC,OAAO;QACN,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;QAC3D,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAAC,eAAe,EAAE,iBAAiB,CAAC;KAC7E,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,SAAS,gBAAgB,CAAC,QAA4B,EAAE,KAAgC;IACvF,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,IAAI,CACX,4DAA4D,KAAK,KAAK,QAAQ,KAAK;cACjF,sCAAsC,MAAM,EAAE,CAChD,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -3,9 +3,10 @@
3
3
  */
4
4
  export type { KVStore, KVEntry, WriteBatch, WriteOptions, BatchOp, AtomicBatch, IterateOptions, KVStoreFactory, KVStoreOptions, KVStoreProvider, } from './kv-store.js';
5
5
  export { defaultGetMany } from './kv-store.js';
6
+ export { PARITY_COST_PROFILE, resolveCostProfile, type KVCostProfile, type ResolvedCostProfile, } from './cost-profile.js';
6
7
  export { pagedIterate, type FetchBatch } from './paged-iterate.js';
7
8
  export { encodeValue, encodeCompositeKey, decodeValue, decodeCompositeKey, BUILTIN_KEY_NORMALIZER_RESOLVER, assertNoUnpairedSurrogate, findUnpairedSurrogate, type EncodeOptions, type KeyValueTransform, } from './encoding.js';
8
- export { serializeRow, deserializeRow, serializeValue, deserializeValue, serializeStats, deserializeStats, type TableStats, } from './serialization.js';
9
+ export { serializeRow, deserializeRow, serializeValue, deserializeValue, serializeStats, deserializeStats, histogramColumns, toPersistedColumnStats, type TableStats, } from './serialization.js';
9
10
  export { STORE_SUFFIX, CATALOG_STORE_NAME, STATS_STORE_NAME, buildDataStoreName, buildIndexStoreName, buildStatsStoreName, buildStatsKey, buildDataKey, buildIndexKey, type IndexKeyHalf, buildCatalogKey, buildViewCatalogKey, buildMaterializedViewCatalogKey, parseMaterializedViewCatalogKey, buildMetaCatalogKey, CLEAN_SHUTDOWN_META_NAME, STALE_MVS_META_NAME, classifyCatalogKey, type CatalogEntryKind, buildFullScanBounds, buildIndexPrefixBounds, buildPkPrefixBounds, buildCatalogScanBounds, KEY_PREFIX, buildTablePrefix, buildTableScanBounds, buildIndexScanBounds, buildMetaKey, buildMetaScanBounds, } from './key-builder.js';
10
11
  export { StoreEventEmitter, type SchemaChangeEvent, type DataChangeEvent, type SchemaChangeListener, type DataChangeListener, } from './events.js';
11
12
  export { generateTableDDL, generateIndexDDL, generateViewDDL, generateMaintainedTableDDL, generateIndexTagsDDL } from '@quereus/quereus';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,OAAO,EACP,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EACL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,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAG9F,OAAO,EACN,yBAAyB,EACzB,YAAY,EACZ,KAAK,yBAAyB,GAC9B,MAAM,qBAAqB,CAAC"}
@@ -3,12 +3,14 @@
3
3
  */
4
4
  // Shared `getMany` fallback for backends without a native batch point-read
5
5
  export { defaultGetMany } from './kv-store.js';
6
+ // Per-backend cost declaration consumed by access planning
7
+ export { PARITY_COST_PROFILE, resolveCostProfile, } from './cost-profile.js';
6
8
  // Bounded paging for backends without a streaming cursor
7
9
  export { pagedIterate } from './paged-iterate.js';
8
10
  // Key encoding
9
11
  export { encodeValue, encodeCompositeKey, decodeValue, decodeCompositeKey, BUILTIN_KEY_NORMALIZER_RESOLVER, assertNoUnpairedSurrogate, findUnpairedSurrogate, } from './encoding.js';
10
12
  // Row serialization
11
- export { serializeRow, deserializeRow, serializeValue, deserializeValue, serializeStats, deserializeStats, } from './serialization.js';
13
+ export { serializeRow, deserializeRow, serializeValue, deserializeValue, serializeStats, deserializeStats, histogramColumns, toPersistedColumnStats, } from './serialization.js';
12
14
  // Key building - new API
13
15
  export { STORE_SUFFIX, CATALOG_STORE_NAME, STATS_STORE_NAME, buildDataStoreName, buildIndexStoreName, buildStatsStoreName, buildStatsKey, buildDataKey, buildIndexKey, buildCatalogKey, buildViewCatalogKey, buildMaterializedViewCatalogKey, parseMaterializedViewCatalogKey, buildMetaCatalogKey, CLEAN_SHUTDOWN_META_NAME, STALE_MVS_META_NAME, classifyCatalogKey, buildFullScanBounds, buildIndexPrefixBounds, buildPkPrefixBounds, buildCatalogScanBounds,
14
16
  // Legacy exports (deprecated)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,yDAAyD;AACzD,OAAO,EAAE,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAEnE,eAAe;AACf,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,yBAAyB,EACzB,qBAAqB,GAGtB,MAAM,eAAe,CAAC;AAEvB,oBAAoB;AACpB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,yBAAyB;AACzB,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EAEb,eAAe,EACf,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAElB,mBAAmB,EACnB,sBAAsB,EACtB,m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;AAChC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAElE,qBAAqB;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,0BAA0B;AAC1B,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AAExE,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAsB,MAAM,kBAAkB,CAAC;AAGlE,yDAAyD;AACzD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAEhC,wDAAwD;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,qFAAqF;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,wFAAwF;AACxF,mEAAmE;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,4BAA4B;AAC5B,OAAO,EACN,yBAAyB,EACzB,YAAY,GAEZ,MAAM,qBAAqB,CAAC"}
@@ -2,6 +2,7 @@
2
2
  * Abstract key-value store interface.
3
3
  * Implemented by LevelDBStore (Node.js) and IndexedDBStore (browser).
4
4
  */
5
+ import type { KVCostProfile } from './cost-profile.js';
5
6
  /**
6
7
  * Options for iterating over key-value pairs.
7
8
  */
@@ -291,6 +292,21 @@ export interface KVStoreOptions {
291
292
  * so two spellings of one logical store cannot produce two cached handles.
292
293
  */
293
294
  export interface KVStoreProvider {
295
+ /**
296
+ * How expensive this backend's basic read operations are, relative to reading one row
297
+ * sequentially during a full scan. Omitted (and every omitted field within it) means
298
+ * the parity defaults, which reproduce the module's pre-profile cost constants exactly
299
+ * — so a provider that declares nothing plans byte-identically to before.
300
+ *
301
+ * Declared on the PROVIDER rather than on a store because a cost profile is a property
302
+ * of the BACKEND, one provider is the per-backend singleton, and `StoreModuleBase`
303
+ * already holds the provider without having to open anything.
304
+ *
305
+ * Declare only MEASURED numbers. An unmeasured guess here is worse than the parity
306
+ * default: it changes advertised costs for every query on the backend. See
307
+ * {@link KVCostProfile}.
308
+ */
309
+ readonly costProfile?: KVCostProfile;
294
310
  /**
295
311
  * Get or create a KVStore for a table's row data.
296
312
  * Store name: {schema}.{table}
@@ -1 +1 @@
1
- {"version":3,"file":"kv-store.d.ts","sourceRoot":"","sources":["../../../src/common/kv-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,gEAAgE;IAChE,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,2BAA2B;IAC3B,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,wDAAwD;IACxD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,OAAO,GAChB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IAC1B,mFAAmF;IACnF,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAA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AAC,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"kv-store.js","sourceRoot":"","sources":["../../../src/common/kv-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsPH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAC7B,KAA2B,EAC3B,IAA2B;IAE3B,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -17,7 +17,7 @@
17
17
  * it was meant to protect, so the inner object would already have been decoded
18
18
  * (or thrown) before the wrapper could suppress it.
19
19
  */
20
- import type { Row, SqlValue } from '@quereus/quereus';
20
+ import type { ColumnStatistics, Row, SqlValue, TableSchema } from '@quereus/quereus';
21
21
  /**
22
22
  * Serialize a row to a byte array for storage.
23
23
  */
@@ -35,18 +35,77 @@ export declare function serializeValue(value: SqlValue): Uint8Array;
35
35
  */
36
36
  export declare function deserializeValue(buffer: Uint8Array): SqlValue;
37
37
  /**
38
- * Table statistics stored in metadata.
38
+ * Table statistics stored in metadata — one record per table in the unified
39
+ * `__stats__` store, keyed by `schema.table`.
40
+ *
41
+ * `rowCount` / `updatedAt` are the LIVE size the write paths delta-track and flush.
42
+ * The three optional fields are the `ANALYZE` snapshot, written only by
43
+ * `StoreTableBase.saveStatistics`. They are optional so a record written before column
44
+ * statistics were persisted reads back cleanly as "no column statistics" — no migration
45
+ * step and no version field.
39
46
  */
40
47
  export interface TableStats {
41
48
  rowCount: number;
42
49
  updatedAt: number;
50
+ /**
51
+ * Per-column statistics keyed by LOWERCASE column name — the same key
52
+ * `TableStatistics.columnStats` uses. Name-keyed by design: a column renamed or
53
+ * dropped between the `ANALYZE` and the reopen is then simply never looked up (and its
54
+ * entry is dead weight), where a positional key would silently match a DIFFERENT column.
55
+ */
56
+ columnStats?: Record<string, ColumnStatistics>;
57
+ /**
58
+ * The row count the `ANALYZE` that produced {@link columnStats} counted — deliberately
59
+ * NOT {@link rowCount}, which keeps drifting with every mutation after that `ANALYZE`.
60
+ * Every `1/distinctCount` and `nullCount/rows` estimate divides by this, so the
61
+ * numerator and the denominator have to describe the same moment.
62
+ */
63
+ analyzedRowCount?: number;
64
+ /** Epoch ms of that `ANALYZE`, so a staleness check can see how old the snapshot is. */
65
+ lastAnalyzed?: number;
43
66
  }
44
67
  /**
45
68
  * Serialize table statistics.
69
+ *
70
+ * Routed through the row codec's `replacer`, NOT bare `JSON.stringify`: `minValue`,
71
+ * `maxValue` and every `HistogramBucket.upperBound` are `SqlValue`s, so they can be a
72
+ * `bigint` (bare stringify THROWS) or a `Uint8Array` (bare stringify silently mangles it
73
+ * into `{"0":…,"1":…}`, which reads back as an object rather than a blob).
46
74
  */
47
75
  export declare function serializeStats(stats: TableStats): Uint8Array;
48
76
  /**
49
- * Deserialize table statistics.
77
+ * Deserialize table statistics. Reviver-gated exactly like {@link deserializeRow}, so a
78
+ * record holding no markers pays only the scan.
50
79
  */
51
80
  export declare function deserializeStats(buffer: Uint8Array): TableStats;
81
+ /**
82
+ * Which columns keep their histogram on the way to disk: a PRIMARY-KEY member, or the
83
+ * LEADING column of a secondary index. Returned as lowercase column names, matching the
84
+ * `columnStats` key.
85
+ *
86
+ * Why bound it at all: `collectStatisticsFromScan` builds up to 100 buckets per column
87
+ * from a 1000-row sample, and a bucket is three fields — so a histogram runs to roughly
88
+ * 100 × 40 ≈ 4 KB of JSON per column. The whole `__stats__` record is read and written as
89
+ * ONE value, so a 30-column table would carry ~120 KB through every stats flush.
90
+ *
91
+ * Why THIS boundary: a histogram only ever feeds a RANGE estimate
92
+ * (`selectivityFromHistogram`), and a range predicate only becomes a seek on a column the
93
+ * store can address — a PK prefix or an index's leading key column. Every other column's
94
+ * range falls back to the fixed 1/3 guess whether or not a histogram survived the reopen,
95
+ * so dropping it costs a re-`ANALYZE` to recover and nothing else. `distinctCount`,
96
+ * `nullCount`, `minValue` and `maxValue` are persisted for EVERY column regardless — they
97
+ * are what the equality, IS NULL and join estimates read, and they are O(1) bytes each.
98
+ *
99
+ * Reads the ENGINE-facing schema's indexes: the store's hidden `_uc_*` UNIQUE-enforcement
100
+ * indexes are deliberately invisible to the read planner, so a histogram on one could
101
+ * never be turned into a seek. Widen here — deliberately, with the arithmetic above — if
102
+ * a future planner can seek more than this.
103
+ */
104
+ export declare function histogramColumns(schema: TableSchema): Set<string>;
105
+ /**
106
+ * Project the statistics `ANALYZE` collected into the persistable record shape: every
107
+ * column keeps its scalar statistics, and only a {@link histogramColumns} member keeps
108
+ * its histogram.
109
+ */
110
+ export declare function toPersistedColumnStats(columnStats: ReadonlyMap<string, ColumnStatistics>, schema: TableSchema): Record<string, ColumnStatistics>;
52
111
  //# sourceMappingURL=serialization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/common/serialization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiDtD;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAGjD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,GAAG,CAOtD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,CAG1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAG7D;AA+ID;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAE5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EA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AE,WAAW,GAClB,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAYlC"}
@@ -207,14 +207,78 @@ function base64ToUint8Array(base64) {
207
207
  }
208
208
  /**
209
209
  * Serialize table statistics.
210
+ *
211
+ * Routed through the row codec's `replacer`, NOT bare `JSON.stringify`: `minValue`,
212
+ * `maxValue` and every `HistogramBucket.upperBound` are `SqlValue`s, so they can be a
213
+ * `bigint` (bare stringify THROWS) or a `Uint8Array` (bare stringify silently mangles it
214
+ * into `{"0":…,"1":…}`, which reads back as an object rather than a blob).
210
215
  */
211
216
  export function serializeStats(stats) {
212
- return textEncoder.encode(JSON.stringify(stats));
217
+ return textEncoder.encode(JSON.stringify(stats, replacer));
213
218
  }
214
219
  /**
215
- * Deserialize table statistics.
220
+ * Deserialize table statistics. Reviver-gated exactly like {@link deserializeRow}, so a
221
+ * record holding no markers pays only the scan.
216
222
  */
217
223
  export function deserializeStats(buffer) {
218
- return JSON.parse(decoder.decode(buffer));
224
+ const json = decoder.decode(buffer);
225
+ return JSON.parse(json, needsReviver(json) ? reviver : undefined);
226
+ }
227
+ /**
228
+ * Which columns keep their histogram on the way to disk: a PRIMARY-KEY member, or the
229
+ * LEADING column of a secondary index. Returned as lowercase column names, matching the
230
+ * `columnStats` key.
231
+ *
232
+ * Why bound it at all: `collectStatisticsFromScan` builds up to 100 buckets per column
233
+ * from a 1000-row sample, and a bucket is three fields — so a histogram runs to roughly
234
+ * 100 × 40 ≈ 4 KB of JSON per column. The whole `__stats__` record is read and written as
235
+ * ONE value, so a 30-column table would carry ~120 KB through every stats flush.
236
+ *
237
+ * Why THIS boundary: a histogram only ever feeds a RANGE estimate
238
+ * (`selectivityFromHistogram`), and a range predicate only becomes a seek on a column the
239
+ * store can address — a PK prefix or an index's leading key column. Every other column's
240
+ * range falls back to the fixed 1/3 guess whether or not a histogram survived the reopen,
241
+ * so dropping it costs a re-`ANALYZE` to recover and nothing else. `distinctCount`,
242
+ * `nullCount`, `minValue` and `maxValue` are persisted for EVERY column regardless — they
243
+ * are what the equality, IS NULL and join estimates read, and they are O(1) bytes each.
244
+ *
245
+ * Reads the ENGINE-facing schema's indexes: the store's hidden `_uc_*` UNIQUE-enforcement
246
+ * indexes are deliberately invisible to the read planner, so a histogram on one could
247
+ * never be turned into a seek. Widen here — deliberately, with the arithmetic above — if
248
+ * a future planner can seek more than this.
249
+ */
250
+ export function histogramColumns(schema) {
251
+ const names = new Set();
252
+ const add = (columnIndex) => {
253
+ const column = schema.columns[columnIndex];
254
+ if (column)
255
+ names.add(column.name.toLowerCase());
256
+ };
257
+ for (const pk of schema.primaryKeyDefinition)
258
+ add(pk.index);
259
+ for (const index of schema.indexes ?? []) {
260
+ const leading = index.columns[0];
261
+ if (leading)
262
+ add(leading.index);
263
+ }
264
+ return names;
265
+ }
266
+ /**
267
+ * Project the statistics `ANALYZE` collected into the persistable record shape: every
268
+ * column keeps its scalar statistics, and only a {@link histogramColumns} member keeps
269
+ * its histogram.
270
+ */
271
+ export function toPersistedColumnStats(columnStats, schema) {
272
+ const keepHistogram = histogramColumns(schema);
273
+ const persisted = {};
274
+ for (const [name, stats] of columnStats) {
275
+ if (stats.histogram === undefined || keepHistogram.has(name)) {
276
+ persisted[name] = stats;
277
+ continue;
278
+ }
279
+ const { histogram: _dropped, ...rest } = stats;
280
+ persisted[name] = rest;
281
+ }
282
+ return persisted;
219
283
  }
220
284
  //# sourceMappingURL=serialization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../src/common/serialization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,+FAA+F;AAC/F,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,kFAAkF;AAClF,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAElD,uFAAuF;AACvF,MAAM,WAAW,GAAG,6BAA6B,CAAC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IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAAkD,EAClD,MAAmB;IAEnB,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAqC,EAAE,CAAC;IACvD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC;QACxC,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACxB,SAAS;QACX,CAAC;QACD,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QAC/C,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -17,6 +17,7 @@
17
17
  * no module state beyond the table's configured key collation, which the caller passes in.
18
18
  */
19
19
  import type { BestAccessPlanRequest, BestAccessPlanResult, Database, TableSchema } from '@quereus/quereus';
20
+ import { type ResolvedCostProfile } from './cost-profile.js';
20
21
  /**
21
22
  * The access plan this module advertises for `request`, before the caller stamps the
22
23
  * module-wide `honorsCollatedRangeBounds` flag onto it.
@@ -27,6 +28,10 @@ import type { BestAccessPlanRequest, BestAccessPlanResult, Database, TableSchema
27
28
  * K for an undecorated text PK member. The secondary-index arm never sees it: index key
28
29
  * bytes encode under each index column's own collation, so {@link tryIndexAccessPlan}
29
30
  * judges its filters against that instead.
31
+ *
32
+ * `costProfile` is the BACKEND's declared price for a random point read and a seek key,
33
+ * resolved once per module (`StoreModuleBase.costProfile`) and passed in for the same
34
+ * reason `tableKeyCollation` is: this function reads no module state of its own.
30
35
  */
31
- export declare function computeBestAccessPlan(db: Database, tableInfo: TableSchema, request: BestAccessPlanRequest, tableKeyCollation: string): BestAccessPlanResult;
36
+ export declare function computeBestAccessPlan(db: Database, tableInfo: TableSchema, request: BestAccessPlanRequest, tableKeyCollation: string, costProfile: ResolvedCostProfile): BestAccessPlanResult;
32
37
  //# sourceMappingURL=store-module-access-plan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-module-access-plan.d.ts","sourceRoot":"","sources":["../../../src/common/store-module-access-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EAIR,WAAW,EACX,MAAM,kBAAkB,CAAC;AAiQ1B;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACpC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,qBAAqB,EAC9B,iBAAiB,EAAE,MAAM,GACvB,oBAAoB,CA6MtB"}
1
+ {"version":3,"file":"store-module-access-plan.d.ts","sourceRoot":"","sources":["../../../src/common/store-module-access-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,oBAAoB,EAEpB,QAAQ,EAIR,WAAW,EAEX,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAsblF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACpC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,qBAAqB,EAC9B,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,mBAAmB,GAC9B,oBAAoB,CAoOtB"}