Files
2026-10-03 11:14:52 +03:00

69 lines
3.0 KiB
Plaintext

== rollback of composite chat creation
expected failure: IntegrityError
PASS: create_chat_with_members fails on a missing member
PASS: chat row was rolled back together with members
PASS: no chats without members exist in the database
== EXPLAIN for message history pagination
messages total: 67882; in explained chat: 10000
PASS: explained chat has >= 10 000 messages
-- first page
Limit (actual time=0.013..0.018 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_keyset_idx on messages (actual time=0.012..0.015 rows=51 loops=1)
Index Cond: (chat_id = 'bc6206c8-0e5d-48f3-94ea-a5fe15e0a9e5'::uuid)
Buffers: shared hit=4
Planning:
Buffers: shared hit=6
Planning Time: 0.102 ms
Execution Time: 0.037 ms
-- keyset page after position 9000
Limit (actual time=0.013..0.022 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_keyset_idx on messages (actual time=0.012..0.019 rows=51 loops=1)
Index Cond: ((chat_id = 'bc6206c8-0e5d-48f3-94ea-a5fe15e0a9e5'::uuid) AND (ROW(created_at, id) > ROW('2026-10-01 19:08:45.800971+00'::timestamp with time zone, '6f9dad83-2a94-400a-877b-7202790747a3'::uuid)))
Buffers: shared hit=5
Planning Time: 0.050 ms
Execution Time: 0.078 ms
-- OFFSET 9000 (not used by the API)
Limit (actual time=3.380..3.385 rows=51 loops=1)
Buffers: shared hit=208
-> Sort (actual time=2.876..3.174 rows=9051 loops=1)
Sort Key: created_at, id
Sort Method: quicksort Memory: 1713kB
Buffers: shared hit=208
-> Bitmap Heap Scan on messages (actual time=0.226..0.807 rows=10000 loops=1)
Recheck Cond: (chat_id = 'bc6206c8-0e5d-48f3-94ea-a5fe15e0a9e5'::uuid)
Heap Blocks: exact=134
Buffers: shared hit=208
-> Bitmap Index Scan on messages_keyset_idx (actual time=0.212..0.212 rows=10000 loops=1)
Index Cond: (chat_id = 'bc6206c8-0e5d-48f3-94ea-a5fe15e0a9e5'::uuid)
Buffers: shared hit=74
Planning Time: 0.041 ms
Execution Time: 3.564 ms
-- keyset page WITHOUT messages_keyset_idx (rolled back)
Limit (actual time=2.474..2.478 rows=51 loops=1)
Buffers: shared hit=891
-> Sort (actual time=2.472..2.474 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 31kB
Buffers: shared hit=891
-> Seq Scan on messages (actual time=0.405..2.402 rows=999 loops=1)
Filter: ((chat_id = 'bc6206c8-0e5d-48f3-94ea-a5fe15e0a9e5'::uuid) AND (ROW(created_at, id) > ROW('2026-10-01 19:08:45.800971+00'::timestamp with time zone, '6f9dad83-2a94-400a-877b-7202790747a3'::uuid)))
Rows Removed by Filter: 66883
Buffers: shared hit=891
Planning:
Buffers: shared hit=4
Planning Time: 0.097 ms
Execution Time: 2.504 ms
PASS: first page reads the index in order, no Sort
PASS: keyset cursor is an Index Cond, not a filter over the history
PASS: keyset deep page touches fewer buffers than OFFSET (5 < 208)
PASS: index reduces buffers for the deep page (5 < 891)
PASS: db checks