This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Remove extra current_state_events join from queries to grab profile info#15734
Closed
MadLittleMods wants to merge 3 commits intodevelopfrom
Closed
Conversation
… info Spawning from #15731
MadLittleMods
commented
Jun 7, 2023
Comment on lines
-227
to
-232
| SELECT state_key, display_name, avatar_url FROM room_memberships as m | ||
| INNER JOIN current_state_events as c | ||
| ON m.event_id = c.event_id | ||
| AND m.room_id = c.room_id | ||
| AND m.user_id = c.state_key | ||
| WHERE c.type = 'm.room.member' AND c.room_id = ? AND m.membership = ? AND %s |
Contributor
Author
There was a problem hiding this comment.
I think this is equivalent to the old thing. Please double-check.
I assume room_memberships holds current memberships just as much current_state_events would.
room_memberships is an append-only table which means it holds all membership forever but we only look at Membership.JOIN here which should represent current state since they would be LEAVE or some other membership otherwise.
Contributor
Author
There was a problem hiding this comment.
The problem with this is that there are multiple entries for a given user_id and we don't know which is the latest just from the room_memberships table alone
Example:
SELECT user_id, display_name, avatar_url FROM room_memberships
WHERE room_id = '!abc:matrix.org' AND membership = 'join';
user_id | display_name | avatar_url
------------------------------+-------------------------------+-------------------------------------------
@madlittlemods:matrix.org | madlittlemods |
@madlittlemods:matrix.org | madlittlemods | mxc://matrix.org/bDayqThxTIcGNcskzIADknRv
@madlittlemods:matrix.org | madlittlemods (Eric Eastwood) | mxc://matrix.org/bDayqThxTIcGNcskzIADknRv
This was referenced Jun 7, 2023
Closed
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Remove extra
current_state_eventsjoin from queries to grab profile infoSpawning from #15731
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.Pull request includes a sign off(run the linters)