Request: SQLite compiler falls back to full-table reads for zero/one-argument AND and OR
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- sqlite, typescript
- Bereich
- database
Rechercherichtung
Start by locating the SQLite persistence SQL compiler and inspect its handling of and/or expressions with zero or one argument. Check the existing compiler tests and the downstream regression assertion for the generated SQL. Done means one-argument predicates compile directly, empty and/or become true/false predicates, and unsupported children retain fallback behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
The SQLite persistence compiler marks and and or expressions with fewer than two arguments as unsupported.
loadSubsetInternal then omits the SQL WHERE clause, reads and deserializes the entire collection, and filters the rows in JavaScript.
Results can still be correct, but a selective query—or a query that should return no rows—does unnecessary work over the whole cached table.
Versions
@tanstack/db-sqlite-persistence-core:0.4.0@tanstack/browser-db-sqlite-persistence:0.2.25@tanstack/db:0.11.0
The same compiler checks are present in upstream main inspected on October 2, 2026.
Reproduction
Populate a persisted collection with many rows and instrument the SQL passed to its driver:
import { IR } from '@tanstack/db'
const predicate = new IR.Func('eq', [
new IR.PropRef(['id']),
new IR.Value('row-1'),
])
await adapter.loadSubset(collectionId, {
where: new IR.Func('and', [predicate]),
})
await adapter.loadSubset(collectionId, {
where: new IR.Func('or', [predicate]),
})
await adapter.loadSubset(collectionId, {
where: new IR.Func('or', []),
})
Source inspection shows that each expression is rejected by the SQL compiler. The resulting collection read has no WHERE clause.
The empty or case is particularly wasteful: the final result is empty, but the adapter first reads every persisted row.
Expected behavior
Compile these expressions consistently with the core evaluator:
- One-argument
andoror: compile the contained predicate. - Empty
and: compile a true predicate. - Empty
or: compile a false predicate.
Unsupported child expressions should retain the existing fallback behavior.
Downstream workaround
We add these cases to the SQLite compiler. An existing downstream regression assertion checks that an empty-result initialization query includes WHERE (0 = 1) rather than reading the entire cache.
This report is based on source inspection; downstream tests were not rerun for this report.
Related issue
#506 discusses zero/one-argument support in the public query API. This report specifically concerns SQL compilation and full-table fallback in the persistence adapter.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 4k
- Forks
- 277
- Ø Merge
- 17 Std. 40 Min.
- Gemergte PRs (30 T.)
- 223
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus TanStack/db
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Garbage collection cleans up a collection while one of its transactions is still persistingEvtl. vergeben @Nabil372 hat das vor 1 Tag übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
persistedCollectionOptions without a schema can't be passed to createCollection (follow-up to #1452)Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
a10y a10y-audit ai-driven-qa claude
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
linagora/twake-directory-manager#219 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 1 Tag
-
0️⃣ phase/new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Pulse v7: buildPreferencesFromTelos() bypasses telosSectionOrFile(), renders empty on unified-TELOS installsEvtl. vergeben @zephyr91 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
danielmiessler/LifeOS#2393 ·
Maintainer antworten meist innerhalb von 4 Tagen