feat:some_improvement

This commit is contained in:
Оля Мороз
2026-10-07 17:33:29 +03:00
parent 828a9f792a
commit 9773639f52
17 changed files with 620 additions and 23 deletions
+9
View File
@@ -0,0 +1,9 @@
-- Тот же запрос, но planner имеет выбор: узкий vs покрывающий индекс.
-- После VACUUM ANALYZE PostgreSQL может выбрать Index Only Scan.
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT id, chat_id, sender_id, text, created_at
FROM messages
WHERE chat_id = (SELECT id FROM chats ORDER BY created_at LIMIT 1)
AND (created_at, id) > ('2000-01-01T00:00:00Z', '00000000-0000-0000-0000-000000000000')
ORDER BY created_at, id
LIMIT 51;