Limit (cost=1673.53..1673.58 rows=20 width=238) (actual time=0.129..0.130 rows=1.00 loops=1) Buffers: shared hit=11 read=1 -> Sort (cost=1673.53..1674.03 rows=202 width=238) (actual time=0.127..0.128 rows=1.00 loops=1) Sort Key: created_at, id Sort Method: quicksort Memory: 25kB Buffers: shared hit=11 read=1 -> Bitmap Heap Scan on messages (cost=8.89..1665.79 rows=202 width=238) (actual time=0.104..0.104 rows=1.00 loops=1) Recheck Cond: (chat_id = $1) Filter: (ROW(created_at, id) > ROW($2, $3)) Rows Removed by Filter: 79 Heap Blocks: exact=4 Buffers: shared hit=5 read=1 -> Bitmap Index Scan on messages_chat_only (cost=0.00..8.84 rows=606 width=0) (actual time=0.064..0.064 rows=80.00 loops=1) Index Cond: (chat_id = $1) Index Searches: 1 Buffers: shared hit=1 read=1 Planning: Buffers: shared hit=97 Planning Time: 0.368 ms Execution Time: 0.207 ms