Files
mtusi2026lab2/evidence/explain.txt
T
2026-09-30 12:13:29 +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: 81809; in explained chat: 10000
PASS: explained chat has >= 10 000 messages
-- first page
Limit (actual time=0.026..0.042 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_keyset_idx on messages (actual time=0.025..0.034 rows=51 loops=1)
Index Cond: (chat_id = 'd00c8d51-a786-404d-aea9-c8447ec0614b'::uuid)
Buffers: shared hit=4
Planning:
Buffers: shared hit=6
Planning Time: 0.208 ms
Execution Time: 0.079 ms
-- keyset page after position 9000
Limit (actual time=0.063..0.084 rows=51 loops=1)
Buffers: shared hit=4 read=1
-> Index Scan using messages_keyset_idx on messages (actual time=0.062..0.076 rows=51 loops=1)
Index Cond: ((chat_id = 'd00c8d51-a786-404d-aea9-c8447ec0614b'::uuid) AND (ROW(created_at, id) > ROW('2026-09-28 16:11:52.757537+00'::timestamp with time zone, 'cab6bb16-0f15-46a0-8f5e-13cb8416fd5e'::uuid)))
Buffers: shared hit=4 read=1
Planning Time: 0.135 ms
Execution Time: 0.215 ms
-- OFFSET 9000 (not used by the API)
Limit (actual time=8.594..8.607 rows=51 loops=1)
Buffers: shared hit=265
-> Sort (actual time=7.284..8.013 rows=9051 loops=1)
Sort Key: created_at, id
Sort Method: quicksort Memory: 1713kB
Buffers: shared hit=265
-> Bitmap Heap Scan on messages (actual time=0.651..2.145 rows=10000 loops=1)
Recheck Cond: (chat_id = 'd00c8d51-a786-404d-aea9-c8447ec0614b'::uuid)
Heap Blocks: exact=134
Buffers: shared hit=265
-> Bitmap Index Scan on messages_keyset_idx (actual time=0.615..0.616 rows=10000 loops=1)
Index Cond: (chat_id = 'd00c8d51-a786-404d-aea9-c8447ec0614b'::uuid)
Buffers: shared hit=131
Planning Time: 0.150 ms
Execution Time: 9.005 ms
-- keyset page WITHOUT messages_keyset_idx (rolled back)
Limit (actual time=7.478..7.490 rows=51 loops=1)
Buffers: shared hit=1076
-> Sort (actual time=7.475..7.479 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 31kB
Buffers: shared hit=1076
-> Seq Scan on messages (actual time=2.279..7.304 rows=999 loops=1)
Filter: ((chat_id = 'd00c8d51-a786-404d-aea9-c8447ec0614b'::uuid) AND (ROW(created_at, id) > ROW('2026-09-28 16:11:52.757537+00'::timestamp with time zone, 'cab6bb16-0f15-46a0-8f5e-13cb8416fd5e'::uuid)))
Rows Removed by Filter: 80810
Buffers: shared hit=1076
Planning:
Buffers: shared hit=4
Planning Time: 0.204 ms
Execution Time: 7.569 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 < 265)
PASS: index reduces buffers for the deep page (5 < 1076)
PASS: db checks