File tree 3 files changed +23
-1
lines changed
synapse/storage/schema/delta/56
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ Reduce database IO usage by optimising queries for current membership.
Original file line number Diff line number Diff line change
1
+ /* Copyright 2019 The Matrix.org Foundation C.I.C.
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ -- We add membership to current state so that we don't need to join against
17
+ -- room_memberships, which can be surprisingly costly (we do such queries
18
+ -- very frequently).
19
+ -- This will be null for non-membership events and the content.membership key
20
+ -- for membership events. (Will also be null for membership events until the
21
+ -- background update job has finished).
22
+ ALTER TABLE current_state_events ADD membership TEXT ;
Original file line number Diff line number Diff line change 19
19
-- This will be null for non-membership events and the content.membership key
20
20
-- for membership events. (Will also be null for membership events until the
21
21
-- background update job has finished).
22
- ALTER TABLE current_state_events ADD membership TEXT ;
23
22
24
23
INSERT INTO background_updates (update_name, progress_json) VALUES
25
24
(' current_state_events_membership' , ' {}' );
You can’t perform that action at this time.
0 commit comments