Skip to content

perf(persistence): add indexes to speed up offline channel-list reads (v9)#2801

Open
VelikovPetar wants to merge 2 commits into
v9from
port/master-to-v9/FLU-555_add-sqlite-indexes-for-offline-read
Open

perf(persistence): add indexes to speed up offline channel-list reads (v9)#2801
VelikovPetar wants to merge 2 commits into
v9from
port/master-to-v9/FLU-555_add-sqlite-indexes-for-offline-read

Conversation

@VelikovPetar

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-555

Github Issue: #

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

Backport of #2795 from master to v9.

Original commit: ab20145 — perf(persistence): add SQLite indexes to speed up offline channel-list reads

Adds @TableIndex annotations on the columns the offline read filters by:

  • messages(channel_cid) — dominant (largest table, scanned ~30× per refresh)
  • members(channel_cid)
  • reads(channel_cid)
  • reactions(message_id)

Schema version bumped 30 → 31. The migration strategy on v9 is fully destructive (createAll() on any version change), so no hand-written migration is needed — both fresh installs and upgrades pick up the indexes automatically.

The .g.dart file was updated by adding only the index late final declarations and allSchemaEntities list entries, without running a full build_runner regeneration (which would produce unrelated codegen-version diff noise on v9).

Port type: Manual (schema version number differs between master and v9; all other changes applied identically).

Screenshots / Videos

No UI changes.

…t reads (v9)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 79058f4e-270d-4c33-9183-576472e021ea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch port/master-to-v9/FLU-555_add-sqlite-indexes-for-offline-read

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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

⚠️ Database Entity Files Modified

The following database entity files have been modified in this PR:

packages/stream_chat_persistence/lib/src/entity/members.dart
packages/stream_chat_persistence/lib/src/entity/messages.dart
packages/stream_chat_persistence/lib/src/entity/reactions.dart
packages/stream_chat_persistence/lib/src/entity/reads.dart

📝 Remember to:

  1. ✅ Database schema version bumped to 31.
  2. Update entity schema tests if necessary.

Note: This comment is automatically generated by the CI workflow.

@VelikovPetar VelikovPetar changed the title perf(persistence): add SQLite indexes to speed up offline channel-list reads (v9) perf(persistence): add indexes to speed up offline channel-list reads (v9) Jul 8, 2026
@VelikovPetar VelikovPetar marked this pull request as ready for review July 8, 2026 18:33
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v9@95c2b25). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             v9    #2801   +/-   ##
=====================================
  Coverage      ?   66.31%           
=====================================
  Files         ?      429           
  Lines         ?    27092           
  Branches      ?        0           
=====================================
  Hits          ?    17965           
  Misses        ?     9127           
  Partials      ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant