docker compose --env-file .env exec db psql -U messenger -d messenger -c "EXPLAIN (ANALYZE, BUFFERS) SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at FROM messages m WHERE m.chat_id = '22222222-2222-4222-8222-222222222222' AND (m.created_at > '2026-09-15 00:00:00+00' OR (m.created_at = '2026-09-15 00:00:00+00' AND m.id > '00000000-0000-0000-0000-000000000000')) ORDER BY m.created_at ASC, m.id ASC LIMIT 50;" 2>&1 | Tee-Object "$EV4\12-explain-keyset-or.txt" QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.29..8.02 rows=50 width=168) (actual time=1.081..1.097 rows=50 loops=1) Buffers: shared hit=2143 -> Index Scan using idx_messages_chat_created_asc_id on messages m (cost=0.29..1224.61 rows=7918 width=168) (actual time=1.080..1.094 rows=50 loops=1) Index Cond: (chat_id = '22222222-2222-4222-8222-222222222222'::uuid) Filter: ((created_at > '2026-09-15 00:00:00+00'::timestamp with time zone) OR ((created_at = '2026-09-15 00:00:00+00'::timestamp with time zone) AND (id > '00000000-0000-0000-0000-000000000000'::uuid))) Rows Removed by Filter: 2084 Buffers: shared hit=2143 Planning: Buffers: shared hit=116 Planning Time: 0.667 ms Execution Time: 1.141 ms (11 rows)