                                                                               QUERY PLAN                                                                               
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=5.42..193.35 rows=51 width=178) (actual time=0.231..0.269 rows=51 loops=1)
   Buffers: shared hit=18
   InitPlan 1 (returns $0)
     ->  Limit  (cost=5.00..5.00 rows=1 width=24) (actual time=0.144..0.145 rows=1 loops=1)
           Buffers: shared hit=5
           ->  Sort  (cost=5.00..5.50 rows=200 width=24) (actual time=0.144..0.144 rows=1 loops=1)
                 Sort Key: chats.created_at
                 Sort Method: top-N heapsort  Memory: 25kB
                 Buffers: shared hit=5
                 ->  Seq Scan on chats  (cost=0.00..4.00 rows=200 width=24) (actual time=0.015..0.046 rows=200 loops=1)
                       Buffers: shared hit=2
   ->  Index Scan using idx_messages_chat_created_id on messages  (cost=0.42..2763.99 rows=750 width=178) (actual time=0.230..0.262 rows=51 loops=1)
         Index Cond: ((chat_id = $0) AND (ROW(created_at, id) > ROW('2000-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))
         Buffers: shared hit=18
 Planning:
   Buffers: shared hit=130
 Planning Time: 1.978 ms
 Execution Time: 0.484 ms
(18 rows)

