This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
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.
Include whether the requesting user has participated in a thread. #11577
Include whether the requesting user has participated in a thread. #11577
Changes from 5 commits
f8c60d1
66fa2a3
f7e6108
b58c637
9003647
a9cd415
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Any idea how well this performs? E.g. are there relevant indices for the query planner to make use of?
I see
I'd guess this means it has to scan the entire room or thread to find the sender of interest. Maybe that's fine---we're assuming most threads aren't that long?
For what it's worth:
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.
I'm not sure, but it is pretty much the same as the other queries we're doing on relations, so I don't think it will be a problem?
I wonder if these queries (in general) would benefit from an index of
relates_to_id
,relation_type
. The current one seems to includeaggregation_key
.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.
Sounds good to me.
As for the indices, I think the existing one is sufficient, because a btree index on (X, Y, Z) can be used as an index on (X, Y). But I can't find a reference for this. Maybe @reivilibre knows one?
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.
Searching for "Index" and "prefix" gets you stuff related to
WHERE strcol LIKE 'foo%'
. What I wanted to find washttps://use-the-index-luke.com/sql/where-clause/the-equals-operator/concatenated-keys and https://www.postgresql.org/docs/10/indexes-multicolumn.html . To quote from postgres docs specifically