Skip to content

perf(sqlite): inject LIMIT before materializing SQL results (#415) - #429

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/415-sqlite-inject-limit
Jul 27, 2026
Merged

perf(sqlite): inject LIMIT before materializing SQL results (#415)#429
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/415-sqlite-inject-limit

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

  • Extract shared injectSqlLimit to lib/core/database/sql_limit.dart (re-exported from postgres_sql.dart)
  • SQLite SQL workspace injects LIMIT for SELECT / WITH / VALUES before execute
  • Keep client-side .take(cap) as fallback; document caps in docs/user-guide.md
  • Add test/core/database/sql_limit_test.dart

Closes #415
Parent: #414

Test plan

  • flutter test test/core/database/sql_limit_test.dart test/core/database/postgres_sql_test.dart
  • Manual: SQLite SELECT * FROM large_table without LIMIT → status shows capped; query plan uses LIMIT
  • Manual: query with author LIMIT 10 unchanged
  • Manual: PRAGMA / INSERT unchanged

Share injectSqlLimit via sql_limit.dart and apply it in the SQLite
SQL workspace so SELECT/WITH/VALUES are bounded at the engine, not
only after rawQuery loads the full set. Document row-cap behavior.

Closes #415
@github-actions github-actions Bot added performance Theme parser epic label: performance sqlite SQLite database driver and workspace core Core library logic and services labels Jul 27, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 5a4ffe0 into dev Jul 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core library logic and services performance Theme parser epic label: performance sqlite SQLite database driver and workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant