11 lines
440 B
SQL
11 lines
440 B
SQL
-- Seed ≥10k messages then EXPLAIN the keyset history query.
|
|
-- Run: docker compose exec -T postgres psql -U messenger -d messenger -f - < evidence/explain.sql
|
|
|
|
EXPLAIN (ANALYZE, BUFFERS)
|
|
SELECT id, chat_id, sender_id, text, created_at
|
|
FROM messages
|
|
WHERE chat_id = (SELECT id FROM chats LIMIT 1)
|
|
AND (created_at, id) > ('1970-01-01'::timestamptz, '00000000-0000-0000-0000-000000000000'::uuid)
|
|
ORDER BY created_at ASC, id ASC
|
|
LIMIT 50;
|