QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.29..4.20 rows=50 width=78) (actual time=0.015..0.025 rows=50 loops=1) Buffers: shared hit=3 -> Index Scan using messages_history_idx on messages (cost=0.29..782.88 rows=10002 width=78) (actual time=0.014..0.019 rows=50 loops=1) Index Cond: (chat_id = 'c66537d0-8434-4560-b135-3fee9c032f46'::uuid) Buffers: shared hit=3 Planning: Buffers: shared hit=107 Planning Time: 0.418 ms Execution Time: 0.045 ms (9 rows)