Files
mtusi2026lab2/evidence/explain_history.txt
2026-11-07 00:02:31 +03:00

59 lines
3.2 KiB
Plaintext

== 2026-11-06T20:46:24Z ==
== версия миграции ==
b7e1f3a9c2d4
== индексы messages ==
Table "public.messages"
Column | Type | Collation | Nullable | Default
------------+--------------------------+-----------+----------+---------
id | uuid | | not null |
chat_id | uuid | | not null |
sender_id | uuid | | not null |
text | text | | not null |
created_at | timestamp with time zone | | |
Indexes:
"messages_pkey" PRIMARY KEY, btree (id)
"ix_messages_chat_created_id" btree (chat_id, created_at, id)
Foreign-key constraints:
"messages_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
"messages_sender_id_fkey" FOREIGN KEY (sender_id) REFERENCES users(id) ON DELETE CASCADE
== сообщений по чатам ==
chat_id | count
--------------------------------------+-------
af3cd510-1663-4fea-8a38-8e15fb90210e | 5
858a289c-ea8f-4ffe-9954-e98f015a072c | 3
00000000-0000-0000-0000-0000000000c1 | 12000
d3a832f7-a587-452e-a61b-8f9fd3651fec | 2
00000000-0000-0000-0000-0000000000c2 | 12000
36aa67a0-0d47-4047-bb68-3e2781cb5b75 | 2
(6 rows)
== первая страница ==
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.41..8.36 rows=51 width=65) (actual time=0.013..0.018 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using ix_messages_chat_created_id on messages (cost=0.41..1870.97 rows=12000 width=65) (actual time=0.012..0.015 rows=51 loops=1)
Index Cond: (chat_id = '00000000-0000-0000-0000-0000000000c1'::uuid)
Buffers: shared hit=5
Planning:
Buffers: shared hit=107
Planning Time: 0.252 ms
Execution Time: 0.032 ms
(9 rows)
== страница из середины (keyset, как в API) ==
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.41..12.80 rows=51 width=65) (actual time=0.016..0.024 rows=51 loops=1)
Buffers: shared hit=6
-> Index Scan using ix_messages_chat_created_id on messages (cost=0.41..1458.70 rows=6002 width=65) (actual time=0.016..0.022 rows=51 loops=1)
Index Cond: ((chat_id = '00000000-0000-0000-0000-0000000000c1'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 01:40:00+00'::timestamp with time zone, '2bd0323e-6c41-2bf3-f433-b3a2ad4a0c44'::uuid)))
Buffers: shared hit=6
Planning:
Buffers: shared hit=106
Planning Time: 0.282 ms
Execution Time: 0.052 ms
(9 rows)