This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fetch thread summaries for multiple events in a single query #11752
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4064b66
Remove unneeded room_id from get_thread_summary.
clokep e395cb4
Remove unneeded room_id from get_thread_participated.
clokep 63c00f6
Support fetching multiple summaries at once.
clokep 85e142a
Support fetching multiple threads at once for participation.
clokep 624b765
Fetch multiple thread summaries and participation at once.
clokep ca012f4
Newsfragment
clokep d5b2a55
Slight optimization to avoid unnecessary queries.
clokep 74b5e12
Reduce the amount of data queried for postgres.
clokep bdc07e1
Merge remote-tracking branch 'origin/develop' into clokep/bundle-redu…
clokep d5f8d19
Do not fetchall, iterate over the transaction.
clokep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Improve performance when fetching bundled aggregations for multiple events. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wanted to combine the queries for last value and counts, you could use a windows:
which I think is as efficient. What's going on here is that the
count() OVER w
andfirst_value(..) OVER w
is operating on the set of rows defined in the windoww
, which in this case is all rows with the sameparent.event_id
.But it's probably easier to keep them as separate queries :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We chatted a bit about this and it seems like it would diverge the Postgresql and sqlite code more, which isn't ideal. @erikjohnston said he was mostly curious if it was doable. 👍
I'll leave this to a future enhancement.