35 lines
1.6 KiB
Plaintext
35 lines
1.6 KiB
Plaintext
# План запроса истории: класс tiny, чат 10
|
|
|
|
Код: src_sha256 8a7e256c540af433, commit 1ddc9449cb49; вариант индекса: no-index
|
|
Страница истории читаемого чата (limit 50); позиция — сколько
|
|
сообщений истории до страницы:
|
|
- first: после 0
|
|
|
|
## Планы приложения
|
|
|
|
auto_explain (ANALYZE, BUFFERS, TIMING): запрос, параметры и план,
|
|
с которыми его выполнило приложение (prepared statement asyncpg).
|
|
|
|
### first
|
|
|
|
duration: 7.361 ms plan:
|
|
Query Text: SELECT messages.id, messages.chat_id, messages.sender_id, messages.text, messages.created_at
|
|
FROM messages
|
|
WHERE messages.chat_id = $1::UUID ORDER BY messages.created_at, messages.id
|
|
LIMIT $2::INTEGER
|
|
Query Parameters: $1 = '0bc9267a-1f2b-4a06-900c-dd4c45bce61e', $2 = '51'
|
|
Limit (cost=5347.35..5347.39 rows=17 width=204) (actual time=7.354..7.355 rows=10.00 loops=1)
|
|
Buffers: shared hit=3772
|
|
-> Sort (cost=5347.35..5347.39 rows=17 width=204) (actual time=7.353..7.353 rows=10.00 loops=1)
|
|
Sort Key: created_at, id
|
|
Sort Method: quicksort Memory: 27kB
|
|
Buffers: shared hit=3772
|
|
-> Seq Scan on messages (cost=0.00..5347.00 rows=17 width=204) (actual time=0.924..7.348 rows=10.00 loops=1)
|
|
Filter: (chat_id = '0bc9267a-1f2b-4a06-900c-dd4c45bce61e'::uuid)
|
|
Rows Removed by Filter: 125990
|
|
Buffers: shared hit=3772
|
|
|
|
## Страница middle без индекса
|
|
|
|
План приложения не использовал индекс: сравнения нет.
|