BEGIN
SET
PREPARE
                                                                     QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.42..582.96 rows=584 width=78) (actual time=0.020..0.032 rows=51 loops=1)
   Buffers: shared hit=2 read=3
   ->  Index Scan using idx_messages_chat_created_id on messages  (cost=0.42..5820.85 rows=5835 width=78) (actual time=0.019..0.028 rows=51 loops=1)
         Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
         Buffers: shared hit=2 read=3
 Planning:
   Buffers: shared hit=6
 Planning Time: 0.128 ms
 Execution Time: 0.054 ms
(9 rows)

ROLLBACK
