Limit (cost=4354.45..4359.89 rows=50 width=66) (actual time=4.163..4.171 rows=50 loops=1) Buffers: shared hit=788 -> Index Scan using messages_chat_history_idx on messages (cost=0.42..8739.72 rows=80287 width=66) (actual time=0.008..3.212 rows=40050 loops=1) Index Cond: (chat_id = '87a5ea91-8f1b-41ae-8ff7-8f67b1711963'::uuid) Buffers: shared hit=788 Planning Time: 0.037 ms Execution Time: 4.180 ms