forked from mtusi2026/mtusi2026lab2
33 lines
1.9 KiB
Plaintext
33 lines
1.9 KiB
Plaintext
PostgreSQL: PostgreSQL 17.6 (Debian 17.6-2.pgdg12+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14+deb12u1) 12.2.0, 64-bit
|
|
Rows in dedicated chat: 10000
|
|
|
|
first
|
|
EXPLAIN (ANALYZE, BUFFERS)
|
|
SELECT id::text,chat_id::text,sender_id::text,text,created_at FROM messages
|
|
WHERE chat_id='aff35ede-28d0-4df7-b577-2a29a956ba40' AND (created_at,id)>('2026-01-01T00:00:00Z'::timestamptz,'00000000-0000-0000-0000-000000000000'::uuid)
|
|
ORDER BY messages.created_at,messages.id LIMIT 51;
|
|
Limit (cost=0.41..16.09 rows=51 width=146) (actual time=0.033..0.045 rows=51 loops=1)
|
|
Buffers: shared hit=4
|
|
-> Index Scan using messages_history_idx on messages (cost=0.41..3074.29 rows=9998 width=146) (actual time=0.031..0.041 rows=51 loops=1)
|
|
Index Cond: ((chat_id = 'aff35ede-28d0-4df7-b577-2a29a956ba40'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))
|
|
Buffers: shared hit=4
|
|
Planning:
|
|
Buffers: shared hit=116
|
|
Planning Time: 0.981 ms
|
|
Execution Time: 0.381 ms
|
|
|
|
deep (after 9000 rows)
|
|
EXPLAIN (ANALYZE, BUFFERS)
|
|
SELECT id::text,chat_id::text,sender_id::text,text,created_at FROM messages
|
|
WHERE chat_id='aff35ede-28d0-4df7-b577-2a29a956ba40' AND (created_at,id)>('2026-01-01T00:00:09Z'::timestamptz,'c4fd0d86-6dcf-4177-a4df-90cebe00e335'::uuid)
|
|
ORDER BY messages.created_at,messages.id LIMIT 51;
|
|
Limit (cost=0.41..108.20 rows=51 width=146) (actual time=0.026..0.040 rows=51 loops=1)
|
|
Buffers: shared hit=5
|
|
-> Index Scan using messages_history_idx on messages (cost=0.41..2367.56 rows=1120 width=146) (actual time=0.025..0.037 rows=51 loops=1)
|
|
Index Cond: ((chat_id = 'aff35ede-28d0-4df7-b577-2a29a956ba40'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:09+00'::timestamp with time zone, 'c4fd0d86-6dcf-4177-a4df-90cebe00e335'::uuid)))
|
|
Buffers: shared hit=5
|
|
Planning:
|
|
Buffers: shared hit=112
|
|
Planning Time: 0.221 ms
|
|
Execution Time: 0.071 ms
|