# EXPLAIN (ANALYZE, BUFFERS) ## history_first_page Limit (cost=0.29..5.40 rows=51 width=73) (actual time=0.007..0.012 rows=51.00 loops=1) Buffers: shared hit=4 -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.29..1002.85 rows=10000 width=73) (actual time=0.006..0.009 rows=51.00 loops=1) Index Cond: (chat_id = '01a0f77e-9381-736f-9a2b-af3b1e1e87fd'::uuid) Index Searches: 1 Buffers: shared hit=4 Planning: Buffers: shared hit=44 Planning Time: 0.147 ms Execution Time: 0.019 ms ## history_next_page Limit (cost=0.29..7.71 rows=51 width=73) (actual time=0.004..0.010 rows=51.00 loops=1) Buffers: shared hit=4 -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.29..524.01 rows=3599 width=73) (actual time=0.004..0.008 rows=51.00 loops=1) Index Cond: ((chat_id = '01a0f77e-9381-736f-9a2b-af3b1e1e87fd'::uuid) AND (ROW(created_at, id) > ROW('2026-10-01 11:44:23.146682+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))) Index Searches: 1 Buffers: shared hit=4 Planning Time: 0.021 ms Execution Time: 0.027 ms ## chats_list_for_member Limit (cost=0.57..446.14 rows=51 width=70) (actual time=0.018..0.081 rows=51.00 loops=1) Buffers: shared hit=309 -> Nested Loop (cost=0.57..87375.78 rows=10001 width=70) (actual time=0.018..0.079 rows=51.00 loops=1) Buffers: shared hit=309 -> Index Scan using chats_created_at_id_idx on chats c (cost=0.29..554.24 rows=10001 width=38) (actual time=0.004..0.007 rows=51.00 loops=1) Index Searches: 1 Buffers: shared hit=3 -> Index Only Scan using chat_members_user_id_chat_id_idx on chat_members visible (cost=0.29..0.36 rows=1 width=16) (actual time=0.001..0.001 rows=1.00 loops=51) Index Cond: ((user_id = '01a0f77e-937a-7d1e-aacb-8909b9a65779'::uuid) AND (chat_id = c.id)) Heap Fetches: 51 Index Searches: 51 Buffers: shared hit=153 SubPlan 1 -> Aggregate (cost=8.31..8.32 rows=1 width=32) (actual time=0.001..0.001 rows=1.00 loops=51) Buffers: shared hit=153 -> Index Only Scan using chat_members_pkey on chat_members m (cost=0.29..8.30 rows=1 width=16) (actual time=0.000..0.000 rows=1.00 loops=51) Index Cond: (chat_id = c.id) Heap Fetches: 51 Index Searches: 51 Buffers: shared hit=153 Planning: Buffers: shared hit=95 Planning Time: 0.250 ms Execution Time: 0.098 ms ## user_by_username Index Scan using users_username_key on users (cost=0.29..8.30 rows=1 width=42) (actual time=0.005..0.005 rows=1.00 loops=1) Index Cond: (username = 'bulk_5000'::text) Index Searches: 1 Buffers: shared hit=3 Planning: Buffers: shared hit=43 Planning Time: 0.085 ms Execution Time: 0.008 ms