6 Commits

Author SHA1 Message Date
Kegan Dougal
a7eed93722 Add comprehensive regression test for GlobalSnapshot(); ensure we clear db conns when tests end 2023-01-18 14:54:26 +00:00
Kegan Dougal
00e4b8238c BREAKING(db) perf: Massively improve time to exec RoomStateAfterEventPosition
The previous query would:
 - Map room IDs to snapshot NIDs
 - UNNEST(events) on all those state snapshots
 - Compare if the type/state_key match the filter

This was very slow under the following circumstances:
 - The rooms have lots of members (e.g Matrix HQ)
 - The required_state has no filter on m.room.member

This is what Element X does.

To improve this, we now have _two_ columns per state snapshot:
 - membership_events : only the m.room.member events
 - events : everything else

Now if a query comes in which doesn't need m.room.member events, we just need
to look in the everything-else bucket of events which is significantly smaller.
This reduces these queries to about 50ms, from 500ms.
2023-01-12 17:11:09 +00:00
Kegan Dougal
d2af339072 Initial cut paginated room member impl 2021-08-06 15:39:36 +01:00
Kegan Dougal
0dcd3fac09 Make tests work for others, add timeline calculations 2021-06-03 14:35:34 +01:00
Kegan Dougal
cd20d07d9f Add Accumulator.Initialise with tests 2021-05-27 19:20:36 +01:00
Kegan Dougal
f3e0f96d91 Add room state tables 2021-05-26 20:01:56 +01:00