Skip to content
Source
Sign inSign up
TanStack/db

fix(db): allow indexing on live-query Collections #2314

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 12 commits intomain fromrefs/pull/2314/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

🎯 Changes

Live-query Collections can now accept autoIndex and defaultIndexType. This lets downstream filters and ordered pages create matching indexes on cached intermediate results. Previously, these configuration entry points omitted both options, so callers needed manual indexes for each downstream order.

Configure the Collection that holds the intermediate rows:

import { BasicIndex, createLiveQueryCollection } from '@tanstack/db'

const cachedUsers = createLiveQueryCollection({
  query: (q) => q.from({ user: usersCollection })
    .select(({ user }) => ({ id: user.id, name: user.name })),
  autoIndex: 'eager',
  defaultIndexType: BasicIndex,
})

const firstUsers = createLiveQueryCollection((q) =>
  q.from({ user: cachedUsers }).orderBy(({ user }) => user.name).limit(20)
)

The downstream query creates its matching index on cachedUsers. The same options work with liveQueryCollectionOptions and framework hook configs. Each output Collection controls its own indexing. The options leave source Collections unchanged and introduce no inherited policy or DbClient default.

Automatic indexing still defaults to 'off'. Eager indexing requires an explicit constructor. A constructor alone supplies the type for manual indexes and leaves automatic indexing off.

Independent React Suspense bindings share an output only when their local Collection options agree. The key includes all supplied options, with exact object/function reference identity. Mounted bindings retain their options until query identity changes. Portable query identity and existing DbClient getKey/schema conflicts stay unchanged.

DbClient.preloadLiveQuery now validates every eager declaration, including warm reuse: defaultIndexType is required even when rows are already cached. Pooling remains limited to configs containing only query, pool, and gcTime; the guide now explains the opt-out from additional keys.

🔬 Oracle Coverage

The original indexing evidence preserves the initial RED/GREEN runs. The high-effort review record evaluates all ten candidates, records the two maintainer decisions, and gives final calibration and limits.

  • Law: Explicit output indexing, independent-caller option compatibility, per-call eager admission, and mounted first-option retention. Authority: Collection's indexing contract and the maintainer decisions recorded above.
  • Reach: 18 core output configurations, nine indexing declarations per framework, 534 Suspense indexing histories, 348 independent local-option histories, and 459 cold/pending/settled preload histories. Warm React cached-result admission also receives 144 cases through Suspense.
  • RED: Original production fails 206/1,314 final React receiving histories and 32/459 preload histories. The old sharing checker accepts a production mutant that drops query hash in all 534 histories.
  • GREEN: Full React suite: 4,039 tests/34 files. Selected DB admission/cache/indexing/error suites: 5,185 tests/7 files. All five other framework receivers pass nine indexing cases each. DB/React typechecks, lint, and production error erasure pass.
  • Mutant: The repaired sharing checker rejects 28 real over-sharing histories. A narrow indexing/getKey/schema-only key fails 110 local-option histories. Equal-name labels fail both registration calibrations. Core comparisons reject extra indexes and inverted optimized-read availability. All source was restored before final verification.
  • Limits: Finite in-memory declarations, initial bindings and held/settled preload delivery. No arbitrary hydration/SSR scheduling, backend paging or benchmark claim. Mounted options deliberately bind until query identity changes. No oracle run budget is lowered.

✅ Checklist

  • Targeted core, adjacent, and all six framework test suites passed locally.
  • TypeScript checks, pnpm lint:changed, and the new guide snippet passed.

🚀 Release Impact

  • This change affects published code and includes a patch changeset for @tanstack/db and @tanstack/react-db.
  • This change is docs/CI/dev-only (no release).

pnpm size:compare --packages db,react-db --files reports 363 gzip bytes and 355 brotli bytes saved across both production package bundles. The typical app saves 319 gzip bytes and 186 brotli bytes. All eight measured app scenarios shrink in both formats. DB alone adds 47 gzip bytes and saves three brotli bytes; React saves 410 gzip and 352 brotli bytes.

The size refactor passes private Suspense metadata directly, removes a stored cache key and duplicate preparation, and lets production bundlers erase development timing state and machinery. Validation and lifecycle/error checks remain enabled. The full React suite is verified with TANSTACK_DB_ORACLE_RUNS_MULTIPLIER=3; a preceding default-budget run missed the streaming campaign's required held-suspense-first state, without a production mismatch. No oracle budget or coverage gate was reduced.

A separate SQLite metadata failure was reproduced on both this PR and its merge-base and is tracked in #2317. CI also found an ordered-replay error-identity mismatch that reproduces on both this head and main 85392bd1d; its exact seed, minimized history, and main control are recorded in #2315. The maintainer chose to track that investigation separately. The replay comparison and random campaign remain unchanged; CI is red on that witness.

Fixes #2292.

Summary by CodeRabbit

  • New Features
    • Configure autoIndex and defaultIndexType for live-query collections and hooks. Automatic indexing remains off by default; eager indexing requires an index constructor.
    • Downstream queries can create matching indexes on live-query results without changing source collection settings. An index constructor alone still allows manual index creation.
  • Bug Fixes
    • React Suspense bindings retain their collection options and share collections only when options are compatible, including object and function references.
    • Eager-indexing configuration is validated on every preload, including when results are cached.
  • Documentation
    • Added guidance on live-query indexing, Suspense option sharing, pooled-query configuration, and when pooled queries compile their own collection.

Oracle follow-up (2026-11-02)

Added omitted-versus-explicit-undefined histories and two-peer pending-source Suspense histories, with per-scope reach guards. Both hostile implementations pass the previous 882 receiver histories; the extended receivers reject them with 88 and 36 intended assertion failures. All 1,074 extended histories pass unchanged production; broader validation passes 1,554 React tests and 744 DB tests, TypeScript, formatting and changed-file lint. No production code changed. Versioned evidence and limits.

    1. 🦋 Changeset detected

      Latest commit: a22b0c47389febac24ae7b7b2fc623f097c9fed8

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 24 packages
      NameType
      @tanstack/dbPatch
      @tanstack/react-dbPatch
      @tanstack/angular-dbPatch
      @tanstack/capacitor-db-sqlite-persistence-e2e-appPatch
      @tanstack/convex-db-collectionPatch
      @tanstack/db-sqlite-persistence-corePatch
      @tanstack/electric-db-collectionPatch
      @tanstack/expo-db-sqlite-persistence-e2e-appPatch
      @tanstack/powersync-db-collectionPatch
      @tanstack/preact-dbPatch
      @tanstack/rxdb-db-collectionPatch
      @tanstack/solid-dbPatch
      @tanstack/svelte-dbPatch
      @tanstack/tauri-db-sqlite-persistence-e2e-appPatch
      @tanstack/trailbase-db-collectionPatch
      @tanstack/vue-dbPatch
      @tanstack/browser-db-sqlite-persistencePatch
      @tanstack/capacitor-db-sqlite-persistencePatch
      @tanstack/cloudflare-durable-objects-db-sqlite-persistencePatch
      @tanstack/electron-db-sqlite-persistencePatch
      @tanstack/expo-db-sqlite-persistencePatch
      @tanstack/node-db-sqlite-persistencePatch
      @tanstack/react-native-db-sqlite-persistencePatch
      @tanstack/tauri-db-sqlite-persistencePatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. Review in Change Stack →

      Note

      Reviews paused

      It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

      • Last reviewed commit: a0d2c4e3780307a770ef7734b64a2d4adf5bd3ce
      • Latest commit, not reviewed: c9c04f88a46b76225f2ddb51f2a70f0eee15c7fb

      Use the following commands to manage reviews:

      • @coderabbitai resume to resume automatic reviews.
      • @coderabbitai review to trigger a single review.

      Use the checkboxes below for quick actions:

      • ▶️ Resume reviews
      • 🔍 Trigger review

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      • Source mode: Auto
      • Repository: Unavailable
      • Branch: Unavailable
      • File: No configuration file from this repository applied
      • Commit: Unavailable
      • Layers: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 10df2075-73b6-4c07-b4f6-cb140516f436
      Commits

      Reviewing files that changed from the base of the PR and between 80985a1ab99c5573fe66dc9d894f575188dbf45c and a0d2c4e3780307a770ef7734b64a2d4adf5bd3ce.

      Files selected for processing: 2
      • docs/contributing/oracle-coverage.md
      • docs/contributing/oracle-reviews/2026-10-30-pr-2314-high-effort-review.md
      Files skipped from review as they are similar to previous changes: 2
      • docs/contributing/oracle-coverage.md
      • docs/contributing/oracle-reviews/2026-10-30-pr-2314-high-effort-review.md

      Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

      Walkthrough

      Live-query Collections now accept autoIndex and defaultIndexType. The settings reach output Collections, and eager indexing without a default index type is validated during Collection construction and each preload. React Suspense cache reuse accounts for source identity and normalized output options.

      Changes: Live-query output indexing

      Layer / File(s)Summary
      Forward and validate indexing settings
      packages/db/src/query/live/types.ts, packages/db/src/query/live/collection-config-builder.ts, packages/db/src/collection/*, packages/db/src/client.ts, packages/db/tests/query/live-query-indexing.test-d.ts, packages/db/tests/fixtures/error-site-messages.json
      LiveQueryCollectionConfig accepts autoIndex and defaultIndexType, and the builder forwards both values. Shared validation rejects eager indexing without a default index type during Collection construction and preload setup.
      Exercise output indexing and preload admission
      packages/db/tests/conformance/*, packages/db/tests/query/custom-index-order-selection-oracle.test.ts, packages/db/tests/live-query-options.test.ts, packages/db/tests/live-query-preload-indexing-oracle.test.ts, packages/{angular,preact,react,solid,svelte,vue}-db/tests/*
      Core tests check output indexing, ordered reads, source updates, pooled-query configuration, and preload admission. Framework drivers register Basic and B-tree index constructors and run the indexing scenarios.
      Qualify React Suspense collection reuse
      packages/react-db/src/*, packages/react-db/tests/*, packages/db/tests/live-query-cache-options-oracle.ts
      Suspense cache lookup uses source identity and normalized output options. Tests cover collection sharing, retained settings, option references, and client-scoped caches.
      Document indexing and cache rules
      docs/guides/live-queries.md, docs/framework/react/overview.md, docs/contributing/oracle-coverage.md, docs/contributing/oracle-reviews/*, .changeset/live-query-output-indexing.md
      Documentation describes indexing configuration, pooling constraints, Suspense option retention, preload validation, and recorded test coverage. The changeset declares patch releases for @tanstack/db and @tanstack/react-db.

      Estimated code review effort: 4 (Complex) | ~35 minutes

      Severity of issue fixed: Medium

      Sequence Diagram(s)

      sequenceDiagram
        participant Binding as React Suspense binding
        participant Key as Suspense key generation
        participant Cache as Suspense collection cache
        Binding->>Key: Provide prepared sources and output options
        Key->>Cache: Look up source identity and normalized options
        Cache-->>Binding: Reuse matching Collection or create one

      Possibly related issues

      • TanStack/db#2292: The change adds and forwards the live-query indexing settings requested by this issue.
      Merge Risk: Minimal · up to a0d2c

      No actionable issue in the selected changes prevents merging after normal checks.

      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title "fix(db): allow indexing on live-query Collections" matches the main change in the changeset. The PR adds autoIndex and defaultIndexType to live-query Collection configuration, which all…
      Linked Issues checkPassedIssue #2292 requires live-query Collection and hook configurations to accept autoIndex and defaultIndexType and forward them to the output Collection. LiveQueryCollectionConfig declares both opt…
      Out of Scope Changes checkPassedThe production changes support the #2292 API. Preload validation, React Suspense option compatibility, framework conformance updates, documentation, oracle tests, and the patch changeset verify or doc…
      Description checkPassedThe description follows the required structure and provides detailed change scope, oracle coverage, test evidence, release impact, known limits, and changeset information. The checklist does not expli…
      Full details: Title check

      Explanation

      The title "fix(db): allow indexing on live-query Collections" matches the main change in the changeset. The PR adds autoIndex and defaultIndexType to live-query Collection configuration, which allows indexing on live-query output Collections. The title names the scope (db, live-query Collections) and the action, and it omits the React Suspense sharing rules, the preload validation, and the pooling constraints. Those are secondary to the main change.

      Full details: Linked Issues check

      Explanation

      Issue #2292 requires live-query Collection and hook configurations to accept autoIndex and defaultIndexType and forward them to the output Collection. LiveQueryCollectionConfig declares both options, CollectionConfigBuilder.getConfig() forwards them, and conformance tests cover automatic indexing, manual index types, downstream ordered reads, rejection of eager indexing without a constructor, and unchanged source indexing. The issue's inheritance alternatives and benchmark are not coding requirements.

      Full details: Out of Scope Changes check

      Explanation

      The production changes support the #2292 API. Preload validation, React Suspense option compatibility, framework conformance updates, documentation, oracle tests, and the patch changeset verify or document the new indexing behavior and its cache semantics. No demonstrated unrelated production change appears in the reviewed scope.

      Full details: Description check

      Explanation

      The description follows the required structure and provides detailed change scope, oracle coverage, test evidence, release impact, known limits, and changeset information. The checklist does not explicitly state that pnpm test was run, but it documents equivalent targeted test and validation commands, so this is a non-critical omission.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 17 functions across 25 files. (2 skipped: 2 unsupported.)

      Resolution

      Write docstrings for the functions missing them to satisfy the coverage threshold.

      Finishing Touches
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      Share
    3. Incremental update benchmark

      Comparing 36b92daff (this PR) against 85392bd1d (base). Write times are per-write medians over 100 iterations (20 warmup writes). Cold hydrate is one timed first load of each query.

      Overall median write time vs base: 1.01× · cold hydrate time: 1.05× (geometric mean of per-case ratios; lower is faster).

      Writes: 3 regression(s), 2 improvement(s) (threshold: ±20% and >0.05ms).

      Cold hydrate: 3 regression(s), 0 improvement(s) (threshold: ±50% and >5ms).

      Per-case flags are noisy on shared runners. Read the geometric means first.

      Writes

      QueryΔ median write time (geomean)Best caseWorst caseFlags
      list: newest 50 open-1.1%-10.1%+30.2%—
      list + author-1.7%-6.4%+15.3%—
      list + comment count+10.3%-8.2%+58.9%3 🔴
      list + 3 recent comments-0.6%-25.5%+30.7%1 🟢
      issue detail + comments+0.2%-31.1%+23.4%1 🟢

      Cold hydrate

      QueryΔ cold hydrate time (geomean)Best caseWorst caseFlags
      list: newest 50 open+4.0%-22.7%+82.5%1 🔴
      list + author+0.4%-32.1%+71.8%1 🔴
      list + comment count-1.0%-36.4%+47.8%—
      list + 3 recent comments+8.0%-26.6%+195.3%1 🔴
      issue detail + comments+18.6%-14.8%+300.3%—

      Each row aggregates the 14.4 scale/index/write-mode configurations of that query; per-configuration tables below.

      100 rows/collection | source indexes: none | synced writes — geomean 0.94×, cold 1.00×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.226ms0.209ms-7.6%0.354ms0.341ms-3.6%13.610ms14.043ms+3.2%
      list: newest 50 open0.553ms0.527ms-4.7%0.943ms0.881ms-6.6%4.199ms4.613ms+9.9%
      list + author0.220ms0.207ms-5.5%0.369ms0.334ms-9.4%10.223ms8.930ms-12.7%
      list + comment count0.354ms0.344ms-2.9%0.588ms0.560ms-4.8%11.718ms12.148ms+3.7%
      list + 3 recent comments0.259ms0.233ms-9.9%0.382ms0.398ms+4.2%9.847ms10.263ms+4.2%
      issue detail + comments0.169ms0.163ms-3.6%0.230ms0.282ms+22.6%1.814ms1.679ms-7.4%
      100 rows/collection | source indexes: none | optimistic writes — geomean 0.98×, cold 1.05×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.150ms0.158ms+5.1%0.254ms0.241ms-5.0%2.021ms1.671ms-17.3%
      list: newest 50 open0.102ms0.099ms-2.7%0.180ms0.187ms+4.3%1.695ms1.467ms-13.4%
      list + author0.169ms0.164ms-3.0%0.292ms0.284ms-2.6%3.769ms4.365ms+15.8%
      list + comment count0.239ms0.236ms-1.1%0.395ms0.421ms+6.6%3.717ms4.728ms+27.2%
      list + 3 recent comments0.142ms0.186ms+30.7%0.251ms0.270ms+7.9%8.376ms12.542ms+49.7%
      issue detail + comments0.182ms0.125ms-31.1%0.314ms0.242ms-22.8%🟢1.282ms1.111ms-13.3%
      100 rows/collection | source indexes: manual | synced writes — geomean 1.02×, cold 1.33×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.120ms0.156ms+30.2%0.272ms0.251ms-7.8%2.809ms3.340ms+18.9%
      list: newest 50 open0.408ms0.368ms-10.0%0.781ms0.648ms-17.0%1.911ms3.270ms+71.2%
      list + author0.135ms0.131ms-2.9%0.263ms0.246ms-6.7%2.785ms2.669ms-4.2%
      list + comment count0.250ms0.249ms-0.6%0.480ms0.451ms-6.0%3.224ms3.183ms-1.3%
      list + 3 recent comments0.166ms0.167ms+0.4%0.258ms0.224ms-13.1%7.139ms5.238ms-26.6%
      issue detail + comments0.130ms0.127ms-2.0%0.247ms0.213ms-13.8%0.619ms2.479ms+300.3%
      100 rows/collection | source indexes: manual | optimistic writes — geomean 1.00×, cold 0.95×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.110ms0.111ms+0.6%0.158ms0.192ms+21.3%1.680ms1.649ms-1.8%
      list: newest 50 open0.089ms0.088ms-1.7%0.182ms0.152ms-16.7%1.050ms1.015ms-3.3%
      list + author0.144ms0.140ms-2.6%0.255ms0.190ms-25.6%2.455ms2.351ms-4.2%
      list + comment count0.217ms0.221ms+1.6%0.352ms0.351ms-0.4%4.730ms3.009ms-36.4%
      list + 3 recent comments0.129ms0.129ms+0.1%0.208ms0.189ms-9.3%5.053ms4.356ms-13.8%
      issue detail + comments0.108ms0.112ms+3.3%0.146ms0.148ms+1.2%0.408ms0.600ms+47.0%
      1,000 rows/collection | source indexes: none | synced writes — geomean 1.09×, cold 1.18×, 3 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.084ms0.084ms-0.2%0.169ms0.173ms+2.1%9.627ms7.445ms-22.7%
      list: newest 50 open1.069ms1.070ms+0.1%2.074ms2.089ms+0.8%6.856ms9.093ms+32.6%
      list + author0.110ms0.126ms+15.3%0.140ms0.229ms+62.9%20.871ms35.863ms+71.8%🔴
      list + comment count0.211ms0.335ms+58.9%0.336ms0.533ms+58.5%🔴14.269ms18.539ms+29.9%
      list + 3 recent comments0.201ms0.150ms-25.5%0.353ms0.242ms-31.3%🟢14.969ms13.514ms-9.7%
      issue detail + comments0.161ms0.199ms+23.4%0.308ms0.303ms-1.7%1.349ms1.781ms+32.0%
      1,000 rows/collection | source indexes: none | optimistic writes — geomean 1.02×, cold 0.98×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.109ms0.117ms+6.7%0.246ms0.203ms-17.6%6.238ms11.388ms+82.5%🔴
      list: newest 50 open0.071ms0.069ms-1.9%0.141ms0.096ms-32.2%6.113ms5.641ms-7.7%
      list + author0.131ms0.128ms-2.6%0.223ms0.224ms+0.5%23.569ms23.949ms+1.6%
      list + comment count0.214ms0.196ms-8.2%0.396ms0.234ms-40.9%13.459ms8.715ms-35.2%
      list + 3 recent comments0.110ms0.122ms+10.8%0.139ms0.167ms+20.3%10.516ms10.112ms-3.8%
      issue detail + comments0.101ms0.110ms+8.6%0.127ms0.138ms+8.1%1.212ms1.033ms-14.8%
      1,000 rows/collection | source indexes: manual | synced writes — geomean 1.02×, cold 1.00×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.081ms0.080ms-2.2%0.105ms0.103ms-2.0%1.038ms1.164ms+12.1%
      list: newest 50 open0.363ms0.332ms-8.5%0.608ms0.601ms-1.2%0.816ms0.807ms-1.2%
      list + author0.112ms0.109ms-3.2%0.193ms0.149ms-23.1%1.948ms1.822ms-6.5%
      list + comment count0.219ms0.228ms+4.3%0.377ms0.385ms+2.1%2.685ms2.886ms+7.5%
      list + 3 recent comments0.138ms0.149ms+8.1%0.173ms0.178ms+2.8%5.874ms5.703ms-2.9%
      issue detail + comments0.100ms0.115ms+15.4%0.127ms0.209ms+65.1%0.453ms0.409ms-9.9%
      1,000 rows/collection | source indexes: manual | optimistic writes — geomean 1.08×, cold 0.94×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.095ms0.096ms+0.7%0.123ms0.122ms-0.5%0.810ms0.791ms-2.3%
      list: newest 50 open0.078ms0.079ms+1.9%0.113ms0.130ms+15.3%1.021ms0.873ms-14.5%
      list + author0.125ms0.123ms-1.8%0.167ms0.151ms-9.7%1.970ms1.843ms-6.4%
      list + comment count0.196ms0.285ms+45.7%0.246ms0.371ms+50.7%🔴2.726ms2.713ms-0.5%
      list + 3 recent comments0.121ms0.127ms+4.6%0.149ms0.158ms+5.8%4.765ms4.108ms-13.8%
      issue detail + comments0.107ms0.110ms+2.7%0.185ms0.154ms-16.8%0.399ms0.422ms+5.6%
      10,000 rows/collection | source indexes: none | synced writes — geomean 1.02×, cold 1.03×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.078ms0.075ms-4.3%0.138ms0.138ms-0.2%72.710ms68.047ms-6.4%
      list: newest 50 open9.712ms9.788ms+0.8%10.291ms10.470ms+1.7%70.016ms64.865ms-7.4%
      list + author0.177ms0.165ms-6.4%0.236ms0.223ms-5.4%223.975ms213.307ms-4.8%
      list + comment count0.244ms0.351ms+43.8%0.364ms0.419ms+15.3%🔴72.562ms73.299ms+1.0%
      list + 3 recent comments0.151ms0.136ms-10.2%0.288ms0.187ms-35.2%86.784ms90.136ms+3.9%
      issue detail + comments0.108ms0.102ms-4.9%0.137ms0.130ms-4.8%6.714ms9.526ms+41.9%
      10,000 rows/collection | source indexes: none | optimistic writes — geomean 0.94×, cold 0.93×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.107ms0.096ms-10.1%0.198ms0.165ms-16.7%67.999ms63.477ms-6.7%
      list: newest 50 open0.070ms0.064ms-9.6%0.112ms0.115ms+3.4%70.736ms62.393ms-11.8%
      list + author0.127ms0.120ms-5.3%0.162ms0.167ms+3.0%213.967ms201.892ms-5.6%
      list + comment count0.225ms0.220ms-2.1%0.261ms0.271ms+3.8%81.023ms72.321ms-10.7%
      list + 3 recent comments0.121ms0.117ms-3.4%0.150ms0.144ms-4.0%72.416ms70.837ms-2.2%
      issue detail + comments0.114ms0.110ms-3.9%0.148ms0.143ms-3.1%5.328ms5.118ms-3.9%
      10,000 rows/collection | source indexes: manual | synced writes — geomean 0.98×, cold 1.29×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.081ms0.075ms-6.8%0.104ms0.100ms-3.8%1.781ms1.727ms-3.0%
      list: newest 50 open0.996ms0.995ms-0.1%1.609ms1.420ms-11.8%3.368ms2.739ms-18.7%
      list + author0.112ms0.111ms-0.9%0.145ms0.209ms+43.8%3.570ms4.340ms+21.6%
      list + comment count0.220ms0.219ms-0.3%0.249ms0.270ms+8.4%3.983ms5.886ms+47.8%
      list + 3 recent comments0.156ms0.145ms-7.2%0.284ms0.176ms-38.2%5.572ms16.453ms+195.3%🔴
      issue detail + comments0.116ms0.120ms+4.1%0.206ms0.188ms-9.1%0.614ms0.682ms+11.0%
      10,000 rows/collection | source indexes: manual | optimistic writes — geomean 1.03×, cold 1.05×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.103ms0.110ms+7.4%0.130ms0.213ms+63.6%1.698ms2.847ms+67.7%
      list: newest 50 open0.084ms0.082ms-2.0%0.114ms0.111ms-2.9%1.598ms1.719ms+7.6%
      list + author0.130ms0.130ms-0.2%0.224ms0.171ms-23.7%5.124ms3.478ms-32.1%
      list + comment count0.241ms0.259ms+7.6%0.286ms0.463ms+62.3%3.866ms3.453ms-10.7%
      list + 3 recent comments0.135ms0.141ms+4.5%0.166ms0.217ms+31.0%4.583ms5.376ms+17.3%
      issue detail + comments0.120ms0.120ms+0.4%0.157ms0.151ms-4.1%0.580ms0.590ms+1.6%
      Runner: node v24.8.0, linux 7.0.0-1017-azure, AMD EPYC 7763 64-Core Processor. Timings on shared CI runners are noisy; treat small deltas as indicative only.
    4. Size Change: -59 B (-0.02%)

      Total Size: 238 kB

      📦 View Changed
      FilenameSizeChange
      packages/db/dist/esm/client.js5.51 kB+27 B (+0.49%)
      packages/db/dist/esm/collection/index.js6.23 kB-92 B (-1.46%)
      packages/db/dist/esm/collection/validate-indexing.js366 B+366 B (new file)🆕
      packages/db/dist/esm/query/live/collection-config-builder.js8.54 kB+21 B (+0.25%)
      packages/react-db/dist/esm/live-query-internals.js0 B-282 B (removed)🏆
      packages/react-db/dist/esm/useLiveInfiniteQuery.js1.45 kB-10 B (-0.69%)
      packages/react-db/dist/esm/useLiveQuery.js3 kB-44 B (-1.45%)
      packages/react-db/dist/esm/useLiveSuspenseQuery.js1.32 kB-45 B (-3.31%)
      ℹ️ View Unchanged
      FilenameSize
      packages/db/dist/esm/collection-options-brand.js219 B
      packages/db/dist/esm/collection-options.js258 B
      packages/db/dist/esm/collection/change-events.js1.76 kB
      packages/db/dist/esm/collection/changes.js3.06 kB
      packages/db/dist/esm/collection/cleanup-queue.js828 B
      packages/db/dist/esm/collection/config-errors.js547 B
      packages/db/dist/esm/collection/events.js504 B
      packages/db/dist/esm/collection/health-tree.js698 B
      packages/db/dist/esm/collection/indexes.js2.3 kB
      packages/db/dist/esm/collection/lifecycle.js5.59 kB
      packages/db/dist/esm/collection/mutations.js2.94 kB
      packages/db/dist/esm/collection/state.js7.69 kB
      packages/db/dist/esm/collection/subscription.js9.86 kB
      packages/db/dist/esm/collection/sync.js6.51 kB
      packages/db/dist/esm/collection/validate-config.js1.17 kB
      packages/db/dist/esm/deferred.js207 B
      packages/db/dist/esm/error-message.js642 B
      packages/db/dist/esm/errors.js7.15 kB
      packages/db/dist/esm/event-emitter.js1.06 kB
      packages/db/dist/esm/index.js4.75 kB
      packages/db/dist/esm/indexed-db-wrapper.js1.91 kB
      packages/db/dist/esm/indexed-db.js3.8 kB
      packages/db/dist/esm/indexes/auto-index.js924 B
      packages/db/dist/esm/indexes/base-index.js1.92 kB
      packages/db/dist/esm/indexes/basic-index.js1.93 kB
      packages/db/dist/esm/indexes/btree-index.js1.62 kB
      packages/db/dist/esm/indexes/index-registry.js916 B
      packages/db/dist/esm/indexes/reverse-index.js1.01 kB
      packages/db/dist/esm/live-query-adapter.js845 B
      packages/db/dist/esm/live-query-observer-client.js2.21 kB
      packages/db/dist/esm/live-query-observer.js3.3 kB
      packages/db/dist/esm/live-query-options.js2.19 kB
      packages/db/dist/esm/live-query-primitives.js406 B
      packages/db/dist/esm/live-query-window-binding.js1.56 kB
      packages/db/dist/esm/live-query-window-controller.js4.02 kB
      packages/db/dist/esm/local-only.js1 kB
      packages/db/dist/esm/local-storage.js4.58 kB
      packages/db/dist/esm/optimistic-action.js359 B
      packages/db/dist/esm/paced-mutations.js1.11 kB
      packages/db/dist/esm/proxy.js3.51 kB
      packages/db/dist/esm/query/builder/clone-query.js854 B
      packages/db/dist/esm/query/builder/functions.js1.61 kB
      packages/db/dist/esm/query/builder/group-keys.js157 B
      packages/db/dist/esm/query/builder/include-functions.js229 B
      packages/db/dist/esm/query/builder/index.js7.72 kB
      packages/db/dist/esm/query/builder/query-ir.js312 B
      packages/db/dist/esm/query/builder/ref-proxy-identity.js292 B
      packages/db/dist/esm/query/builder/ref-proxy.js1.67 kB
      packages/db/dist/esm/query/builder/wrapper-identity.js221 B
      packages/db/dist/esm/query/compiler/evaluators.js2.51 kB
      packages/db/dist/esm/query/compiler/expressions.js603 B
      packages/db/dist/esm/query/compiler/find-aggregate.js328 B
      packages/db/dist/esm/query/compiler/group-by.js4.38 kB
      packages/db/dist/esm/query/compiler/grouping.js161 B
      packages/db/dist/esm/query/compiler/index.js10.7 kB
      packages/db/dist/esm/query/compiler/joins.js3.42 kB
      packages/db/dist/esm/query/compiler/lazy-targets.js1.11 kB
      packages/db/dist/esm/query/compiler/order-by.js2.8 kB
      packages/db/dist/esm/query/compiler/parent-routes.js319 B
      packages/db/dist/esm/query/compiler/query-equivalence.js568 B
      packages/db/dist/esm/query/compiler/route-metadata.js1.24 kB
      packages/db/dist/esm/query/compiler/select.js1.66 kB
      packages/db/dist/esm/query/effect.js5.79 kB
      packages/db/dist/esm/query/equality-conjunct.js486 B
      packages/db/dist/esm/query/equality-value-identity.js736 B
      packages/db/dist/esm/query/expression-helpers.js1.61 kB
      packages/db/dist/esm/query/ir-stable-identity.js4.29 kB
      packages/db/dist/esm/query/ir.js2.26 kB
      packages/db/dist/esm/query/join-conditions.js257 B
      packages/db/dist/esm/query/live-query-collection.js391 B
      packages/db/dist/esm/query/live/bucket-facade-adapter.js3.17 kB
      packages/db/dist/esm/query/live/collection-registry.js264 B
      packages/db/dist/esm/query/live/collection-subscriber.js2.68 kB
      packages/db/dist/esm/query/live/graph-scheduler.js305 B
      packages/db/dist/esm/query/live/includes-runtime.js212 B
      packages/db/dist/esm/query/live/internal.js145 B
      packages/db/dist/esm/query/live/materialized-pipeline.js1.94 kB
      packages/db/dist/esm/query/live/ordered-source-loader.js6.52 kB
      packages/db/dist/esm/query/live/public-key-reduction.js970 B
      packages/db/dist/esm/query/live/subset-demand-controller.js2.44 kB
      packages/db/dist/esm/query/live/utils.js1.35 kB
      packages/db/dist/esm/query/optimizer.js2.95 kB
      packages/db/dist/esm/query/pooled-live-query.js5.14 kB
      packages/db/dist/esm/query/pooled-source.js219 B
      packages/db/dist/esm/query/query-once.js359 B
      packages/db/dist/esm/query/runtime-reference-identity.js630 B
      packages/db/dist/esm/query/subset-dedupe.js493 B
      packages/db/dist/esm/scheduler.js1.23 kB
      packages/db/dist/esm/SortedMap.js1.77 kB
      packages/db/dist/esm/strategies/commit-completion.js154 B
      packages/db/dist/esm/strategies/debounceStrategy.js658 B
      packages/db/dist/esm/strategies/queueStrategy.js523 B
      packages/db/dist/esm/strategies/serial-pacer.js486 B
      packages/db/dist/esm/strategies/throttleStrategy.js738 B
      packages/db/dist/esm/sync-persistence.js669 B
      packages/db/dist/esm/sync-receipt.js211 B
      packages/db/dist/esm/transaction-commit-work.js351 B
      packages/db/dist/esm/transactions.js4.66 kB
      packages/db/dist/esm/utils.js1.7 kB
      packages/db/dist/esm/utils/array-utils.js270 B
      packages/db/dist/esm/utils/browser-polyfills.js304 B
      packages/db/dist/esm/utils/btree.js3.02 kB
      packages/db/dist/esm/utils/callbacks.js219 B
      packages/db/dist/esm/utils/comparison.js1.95 kB
      packages/db/dist/esm/utils/cursor.js753 B
      packages/db/dist/esm/utils/error.js262 B
      packages/db/dist/esm/utils/get-or-create.js155 B
      packages/db/dist/esm/utils/index-optimization.js2.58 kB
      packages/db/dist/esm/utils/source-record.js140 B
      packages/db/dist/esm/utils/type-guards.js230 B
      packages/db/dist/esm/utils/uuid.js530 B
      packages/db/dist/esm/virtual-props.js400 B
      packages/react-db/dist/esm/DbProvider.js317 B
      packages/react-db/dist/esm/development.js190 B
      packages/react-db/dist/esm/HydrationBoundary.js263 B
      packages/react-db/dist/esm/index.js330 B
      packages/react-db/dist/esm/source-id-bindings.js339 B
      packages/react-db/dist/esm/useLiveQueryEffect.js504 B
      packages/react-db/dist/esm/usePacedMutations.js429 B
      compressed-size-action::db-and-react-package-size
    5. More templates

      @tanstack/angular-db

      npm i https://pkg.pr.new/@tanstack/angular-db@2314

      @tanstack/browser-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/browser-db-sqlite-persistence@2314

      @tanstack/capacitor-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/capacitor-db-sqlite-persistence@2314

      @tanstack/cloudflare-durable-objects-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/cloudflare-durable-objects-db-sqlite-persistence@2314

      @tanstack/convex-db-collection

      npm i https://pkg.pr.new/@tanstack/convex-db-collection@2314

      @tanstack/db

      npm i https://pkg.pr.new/@tanstack/db@2314

      @tanstack/db-ivm

      npm i https://pkg.pr.new/@tanstack/db-ivm@2314

      @tanstack/db-sqlite-persistence-core

      npm i https://pkg.pr.new/@tanstack/db-sqlite-persistence-core@2314

      @tanstack/electric-db-collection

      npm i https://pkg.pr.new/@tanstack/electric-db-collection@2314

      @tanstack/electron-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/electron-db-sqlite-persistence@2314

      @tanstack/expo-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/expo-db-sqlite-persistence@2314

      @tanstack/node-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/node-db-sqlite-persistence@2314

      @tanstack/offline-transactions

      npm i https://pkg.pr.new/@tanstack/offline-transactions@2314

      @tanstack/powersync-db-collection

      npm i https://pkg.pr.new/@tanstack/powersync-db-collection@2314

      @tanstack/preact-db

      npm i https://pkg.pr.new/@tanstack/preact-db@2314

      @tanstack/query-db-collection

      npm i https://pkg.pr.new/@tanstack/query-db-collection@2314

      @tanstack/react-db

      npm i https://pkg.pr.new/@tanstack/react-db@2314

      @tanstack/react-native-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/react-native-db-sqlite-persistence@2314

      @tanstack/react-router-with-db

      npm i https://pkg.pr.new/@tanstack/react-router-with-db@2314

      @tanstack/rxdb-db-collection

      npm i https://pkg.pr.new/@tanstack/rxdb-db-collection@2314

      @tanstack/solid-db

      npm i https://pkg.pr.new/@tanstack/solid-db@2314

      @tanstack/svelte-db

      npm i https://pkg.pr.new/@tanstack/svelte-db@2314

      @tanstack/tauri-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/tauri-db-sqlite-persistence@2314

      @tanstack/trailbase-db-collection

      npm i https://pkg.pr.new/@tanstack/trailbase-db-collection@2314

      @tanstack/vue-db

      npm i https://pkg.pr.new/@tanstack/vue-db@2314

      commit: c9c04f8

    6. Additional comments: 2
      docs/contributing/oracle-coverage.md-1963-1963: 1

      1963-1963: Minor · Maintainability & Code Quality · Quick win

      **Unverified finding** Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

      Format the queryKey identifier as code.

      queryKey is an API identifier, not an English word. Write it as `queryKey` to preserve the identifier and avoid the spelling diagnostic.

      Source: Linters/SAST tools

      docs/contributing/oracle-reviews/2026-10-30-pr-2314-high-effort-review.md-25-25: 1

      25-25: Minor · Maintainability & Code Quality · Quick win

      **Unverified finding** Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

      Hyphenate non-React-focused.

      Use non-React-focused in this sentence. The current wording is difficult to parse and is reported by the configured grammar check.

      Source: Linters/SAST tools


      Review info
      Run configuration
      • Source mode: Auto
      • Repository: Unavailable
      • Branch: Unavailable
      • File: No configuration file from this repository applied
      • Commit: Unavailable
      • Layers: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 21f44a11-4a65-466f-a493-12f311bfd0b5
      Commits

      Reviewing files that changed from the base of the PR and between f2c51186921b2a863b0ccd5bfb065b5402650260 and 80985a1ab99c5573fe66dc9d894f575188dbf45c.

      Files selected for processing: 20
      • .changeset/live-query-output-indexing.md
      • docs/contributing/oracle-coverage.md
      • docs/contributing/oracle-reviews/2026-10-30-pr-2314-high-effort-review.md
      • docs/framework/react/overview.md
      • docs/guides/live-queries.md
      • packages/db/src/client.ts
      • packages/db/src/collection/index.ts
      • packages/db/src/collection/validate-indexing.ts
      • packages/db/tests/conformance/indexing-config-oracle.ts
      • packages/db/tests/conformance/indexing-reuse-oracle.test.ts
      • packages/db/tests/fixtures/error-site-messages.json
      • packages/db/tests/live-query-cache-options-oracle.ts
      • packages/db/tests/live-query-options.test.ts
      • packages/db/tests/live-query-preload-indexing-oracle.test.ts
      • packages/db/tests/query/custom-index-order-selection-oracle.test.ts
      • packages/react-db/src/live-query-internals.ts
      • packages/react-db/src/useLiveQuery.ts
      • packages/react-db/tests/cache-options-oracle.test.tsx
      • packages/react-db/tests/suspense-indexing-config-oracle.test.tsx
      • packages/react-db/tests/suspense-local-options-oracle.test.tsx
      Files skipped from review as they are similar to previous changes: 1
      • .changeset/live-query-output-indexing.md

      Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

    7. 🎉 This PR has been released!

      Backfilled notification for published release candidates.

Sign in to join this conversation.