fix whitespace and NULL validation
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-28 20:31:49 +03:00
parent 7a72faf0e9
commit f75ad8cc97
15 changed files with 248 additions and 145 deletions
+16 -16
View File
@@ -6,15 +6,15 @@ WHERE chat_id = :chat_id
ORDER BY created_at, id
LIMIT :page
Limit (actual time=0.006..0.015 rows=51 loops=1)
Limit (actual time=0.006..0.014 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using ix_messages_chat_id_created_at_id on messages (actual time=0.006..0.012 rows=51 loops=1)
Index Cond: (chat_id = '87629e85-f573-467a-b369-74d67ea5f2ac'::uuid)
-> Index Scan using ix_messages_chat_id_created_at_id on messages (actual time=0.005..0.011 rows=51 loops=1)
Index Cond: (chat_id = '5355155b-ec73-4a3a-ac44-2417871c9ddf'::uuid)
Buffers: shared hit=4
Planning:
Buffers: shared hit=6
Planning Time: 0.051 ms
Execution Time: 0.025 ms
Planning Time: 0.046 ms
Execution Time: 0.022 ms
== page after cursor in the middle of history
SELECT * FROM messages
@@ -22,13 +22,13 @@ WHERE chat_id = :chat_id AND (created_at, id) > (:after_created_at, :after_id)
ORDER BY created_at, id
LIMIT :page
Limit (actual time=0.007..0.023 rows=51 loops=1)
Limit (actual time=0.006..0.018 rows=51 loops=1)
Buffers: shared hit=6
-> Index Scan using ix_messages_chat_id_created_at_id on messages (actual time=0.007..0.020 rows=51 loops=1)
Index Cond: ((chat_id = '87629e85-f573-467a-b369-74d67ea5f2ac'::uuid) AND (ROW(created_at, id) > ROW('2026-10-26 19:33:40.369572+00'::timestamp with time zone, '540382ff-297f-48c1-8515-aca3063b8347'::uuid)))
-> Index Scan using ix_messages_chat_id_created_at_id on messages (actual time=0.006..0.015 rows=51 loops=1)
Index Cond: ((chat_id = '5355155b-ec73-4a3a-ac44-2417871c9ddf'::uuid) AND (ROW(created_at, id) > ROW('2026-10-28 16:00:20.004077+00'::timestamp with time zone, 'c9e332b5-5dd0-4279-a4dd-bf2e1451cc69'::uuid)))
Buffers: shared hit=6
Planning Time: 0.044 ms
Execution Time: 0.046 ms
Planning Time: 0.037 ms
Execution Time: 0.040 ms
== same page with index scans disabled (for comparison)
SELECT * FROM messages
@@ -36,16 +36,16 @@ WHERE chat_id = :chat_id AND (created_at, id) > (:after_created_at, :after_id)
ORDER BY created_at, id
LIMIT :page
Limit (actual time=4.477..4.483 rows=51 loops=1)
Limit (actual time=4.010..4.015 rows=51 loops=1)
Buffers: shared hit=618
-> Sort (actual time=4.476..4.479 rows=51 loops=1)
-> Sort (actual time=4.009..4.011 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 31kB
Buffers: shared hit=618
-> Seq Scan on messages (actual time=0.417..4.025 rows=4999 loops=1)
Filter: ((chat_id = '87629e85-f573-467a-b369-74d67ea5f2ac'::uuid) AND (ROW(created_at, id) > ROW('2026-10-26 19:33:40.369572+00'::timestamp with time zone, '540382ff-297f-48c1-8515-aca3063b8347'::uuid)))
-> Seq Scan on messages (actual time=0.379..3.601 rows=4999 loops=1)
Filter: ((chat_id = '5355155b-ec73-4a3a-ac44-2417871c9ddf'::uuid) AND (ROW(created_at, id) > ROW('2026-10-28 16:00:20.004077+00'::timestamp with time zone, 'c9e332b5-5dd0-4279-a4dd-bf2e1451cc69'::uuid)))
Rows Removed by Filter: 45004
Buffers: shared hit=618
Planning Time: 0.038 ms
Execution Time: 4.496 ms
Planning Time: 0.036 ms
Execution Time: 4.024 ms