34 lines
1.6 KiB
Plaintext
34 lines
1.6 KiB
Plaintext
# EXPLAIN (ANALYZE, BUFFERS) для истории сообщений
|
|
# date: 2026-10-02T11:28:14Z
|
|
# chat_id: 349f1aef-3bbc-42d1-8724-e8d22b8c2253
|
|
|
|
## Ключевой запрос пагинации
|
|
QUERY PLAN
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Limit (cost=0.42..8.05 rows=50 width=69) (actual time=0.025..0.042 rows=50 loops=1)
|
|
Buffers: shared hit=45
|
|
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..8419.02 rows=55133 width=69) (actual time=0.024..0.038 rows=50 loops=1)
|
|
Index Cond: (chat_id = '349f1aef-3bbc-42d1-8724-e8d22b8c2253'::uuid)
|
|
Buffers: shared hit=45
|
|
Planning:
|
|
Buffers: shared hit=109
|
|
Planning Time: 0.611 ms
|
|
Execution Time: 0.064 ms
|
|
(9 rows)
|
|
|
|
|
|
## Индексы таблицы messages
|
|
indexname | indexdef
|
|
------------------------------+----------------------------------------------------------------------------------------------------
|
|
messages_pkey | CREATE UNIQUE INDEX messages_pkey ON public.messages USING btree (id)
|
|
messages_chat_created_id_idx | CREATE INDEX messages_chat_created_id_idx ON public.messages USING btree (chat_id, created_at, id)
|
|
(2 rows)
|
|
|
|
|
|
## Оценка размера и количества
|
|
estimated_rows | total_size
|
|
----------------+------------
|
|
110222 | 25 MB
|
|
(1 row)
|
|
|