Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sqlite) Add an index on events.event_id and .room_id #4685

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Feb 19, 2025

This patch adds an index on events.event_id and on events.room_id so that queries on this column are faster. It mostly happens in the Deduplicator, which runs for every backwards pagination or sync.

This patch also updates the query in filter_duplicated_events to sort event by their chunk_id and position so that the results are constant, it helps when testing.


@Hywan Hywan requested a review from a team as a code owner February 19, 2025 09:50
@Hywan Hywan requested review from jmartinesp and bnjbvr and removed request for a team and jmartinesp February 19, 2025 09:50
@Hywan Hywan requested a review from bnjbvr February 19, 2025 10:10
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.85%. Comparing base (6bc9dc5) to head (793a62a).
Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4685      +/-   ##
==========================================
+ Coverage   85.83%   85.85%   +0.01%     
==========================================
  Files         292      292              
  Lines       33758    33763       +5     
==========================================
+ Hits        28977    28987      +10     
+ Misses       4781     4776       -5     

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

This patch adds an index on `events.event_id` and on `events.room_id`
so that queries on this column are faster. It mostly happens for the
`Deduplicator`, which runs for every backwards pagination or sync.

This patch also updates the query in `filter_duplicated_events` to
sort event by their `chunk_id` and `position` so that the results are
constant, it helps when testing.
@Hywan Hywan force-pushed the feat-sqlite-event-cache-event-id-index branch from 5364243 to 793a62a Compare February 19, 2025 10:36
@Hywan Hywan enabled auto-merge (rebase) February 19, 2025 10:38
@Hywan Hywan merged commit 6c57003 into matrix-org:main Feb 19, 2025
42 checks passed
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.

2 participants