QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=1197.95..1209.93 rows=50 width=64) (actual time=0.707..0.717 rows=50 loops=1) Buffers: shared hit=126 -> Index Scan using messages_history_idx on messages (cost=0.42..16699.34 rows=69722 width=64) (actual time=0.012..0.593 rows=5050 loops=1) Index Cond: (chat_id = '136ef7de-de6a-40ec-b0dc-95d805396a72'::uuid) Buffers: shared hit=126 Planning: Buffers: shared hit=137 Planning Time: 0.299 ms Execution Time: 0.732 ms (9 rows)