EXPLAIN (ANALYZE, BUFFERS) SELECT id,chat_id,sender_id,text,created_at FROM messages WHERE chat_id='b882362b-f5e0-4a9c-84f9-1dbe79d7e388' ORDER BY created_at,id LIMIT 101;

                                                                  QUERY PLAN                                                                  
----------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.42..35.63 rows=101 width=66) (actual time=0.021..0.043 rows=101 loops=1)
   Buffers: shared hit=6
   ->  Index Scan using messages_history_idx on messages  (cost=0.42..3483.99 rows=9993 width=66) (actual time=0.020..0.034 rows=101 loops=1)
         Index Cond: (chat_id = 'b882362b-f5e0-4a9c-84f9-1dbe79d7e388'::uuid)
         Buffers: shared hit=6
 Planning:
   Buffers: shared hit=107
 Planning Time: 0.434 ms
 Execution Time: 0.083 ms
(9 rows)

