mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-26 05:31:32 +00:00
Optimise SharedUsers
again by using complete composite index
This commit is contained in:
parent
6ee758df63
commit
955e69a3b7
@ -112,7 +112,7 @@ const selectEventsWithEventIDsSQL = "" +
|
|||||||
const selectSharedUsersSQL = "" +
|
const selectSharedUsersSQL = "" +
|
||||||
"SELECT state_key FROM syncapi_current_room_state WHERE room_id = ANY(" +
|
"SELECT state_key FROM syncapi_current_room_state WHERE room_id = ANY(" +
|
||||||
" SELECT DISTINCT room_id FROM syncapi_current_room_state WHERE state_key = $1 AND membership='join'" +
|
" SELECT DISTINCT room_id FROM syncapi_current_room_state WHERE state_key = $1 AND membership='join'" +
|
||||||
") AND state_key = ANY($2) AND membership IN ('join', 'invite');"
|
") AND type = 'm.room.member' AND state_key = ANY($2) AND membership IN ('join', 'invite');"
|
||||||
|
|
||||||
type currentRoomStateStatements struct {
|
type currentRoomStateStatements struct {
|
||||||
upsertRoomStateStmt *sql.Stmt
|
upsertRoomStateStmt *sql.Stmt
|
||||||
|
@ -96,7 +96,7 @@ const selectEventsWithEventIDsSQL = "" +
|
|||||||
const selectSharedUsersSQL = "" +
|
const selectSharedUsersSQL = "" +
|
||||||
"SELECT state_key FROM syncapi_current_room_state WHERE room_id IN(" +
|
"SELECT state_key FROM syncapi_current_room_state WHERE room_id IN(" +
|
||||||
" SELECT DISTINCT room_id FROM syncapi_current_room_state WHERE state_key = $1 AND membership='join'" +
|
" SELECT DISTINCT room_id FROM syncapi_current_room_state WHERE state_key = $1 AND membership='join'" +
|
||||||
") AND state_key IN ($2) AND membership IN ('join', 'invite');"
|
") AND type = 'm.room.member' AND state_key IN ($2) AND membership IN ('join', 'invite');"
|
||||||
|
|
||||||
type currentRoomStateStatements struct {
|
type currentRoomStateStatements struct {
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
|
Loading…
Reference in New Issue
Block a user