Lab2
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-02 10:28:52 +03:00
parent b6c3aa1e64
commit 8e97518120
5 changed files with 47 additions and 47 deletions
+24 -24
View File
@@ -5,64 +5,64 @@ 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: 61133; in explained chat: 10000
messages total: 65588; in explained chat: 10000
PASS: explained chat has >= 10 000 messages
-- first page
Limit (actual time=0.042..0.048 rows=51 loops=1)
Limit (actual time=0.010..0.016 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_keyset_idx on messages (actual time=0.042..0.045 rows=51 loops=1)
-> Index Scan using messages_keyset_idx on messages (actual time=0.010..0.013 rows=51 loops=1)
Index Cond: (chat_id = '7c57b8e9-42a1-4cf8-904b-08545328a890'::uuid)
Buffers: shared hit=4
Planning:
Buffers: shared hit=6
Planning Time: 0.084 ms
Execution Time: 0.067 ms
Execution Time: 0.034 ms
-- keyset page after position 9000
Limit (actual time=0.010..0.019 rows=51 loops=1)
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.010..0.016 rows=51 loops=1)
-> Index Scan using messages_keyset_idx on messages (actual time=0.012..0.018 rows=51 loops=1)
Index Cond: ((chat_id = '7c57b8e9-42a1-4cf8-904b-08545328a890'::uuid) AND (ROW(created_at, id) > ROW('2026-10-01 07:31:21.6187+00'::timestamp with time zone, '6cbb1e03-f1e2-4113-8a7b-612c90c9761f'::uuid)))
Buffers: shared hit=5
Planning Time: 0.063 ms
Execution Time: 0.069 ms
Planning Time: 0.057 ms
Execution Time: 0.157 ms
-- OFFSET 9000 (not used by the API)
Limit (actual time=3.412..3.417 rows=51 loops=1)
Limit (actual time=4.069..4.075 rows=51 loops=1)
Buffers: shared hit=208
-> Sort (actual time=2.955..3.217 rows=9051 loops=1)
-> Sort (actual time=3.561..3.851 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.240..0.883 rows=10000 loops=1)
-> Bitmap Heap Scan on messages (actual time=0.928..1.508 rows=10000 loops=1)
Recheck Cond: (chat_id = '7c57b8e9-42a1-4cf8-904b-08545328a890'::uuid)
Heap Blocks: exact=134
Buffers: shared hit=208
-> Bitmap Index Scan on messages_keyset_idx (actual time=0.224..0.224 rows=10000 loops=1)
-> Bitmap Index Scan on messages_keyset_idx (actual time=0.913..0.914 rows=10000 loops=1)
Index Cond: (chat_id = '7c57b8e9-42a1-4cf8-904b-08545328a890'::uuid)
Buffers: shared hit=74
Planning Time: 0.110 ms
Execution Time: 3.597 ms
Planning Time: 0.070 ms
Execution Time: 4.209 ms
-- keyset page WITHOUT messages_keyset_idx (rolled back)
Limit (actual time=2.273..2.278 rows=51 loops=1)
Buffers: shared hit=817
-> Sort (actual time=2.271..2.273 rows=51 loops=1)
Limit (actual time=2.486..2.492 rows=51 loops=1)
Buffers: shared hit=877
-> Sort (actual time=2.484..2.486 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 31kB
Buffers: shared hit=817
-> Seq Scan on messages (actual time=0.366..2.188 rows=999 loops=1)
Buffers: shared hit=877
-> Seq Scan on messages (actual time=0.376..2.401 rows=999 loops=1)
Filter: ((chat_id = '7c57b8e9-42a1-4cf8-904b-08545328a890'::uuid) AND (ROW(created_at, id) > ROW('2026-10-01 07:31:21.6187+00'::timestamp with time zone, '6cbb1e03-f1e2-4113-8a7b-612c90c9761f'::uuid)))
Rows Removed by Filter: 60134
Buffers: shared hit=817
Rows Removed by Filter: 64589
Buffers: shared hit=877
Planning:
Buffers: shared hit=4
Planning Time: 0.166 ms
Execution Time: 2.308 ms
Planning Time: 0.107 ms
Execution Time: 2.537 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 < 817)
PASS: index reduces buffers for the deep page (5 < 877)
PASS: db checks