Limit (cost=6162.88..6165.20 rows=20 width=238) (actual time=19.403..27.573 rows=51.00 loops=1) Buffers: shared hit=4307 -> Gather Merge (cost=6162.88..6186.40 rows=202 width=238) (actual time=19.400..27.552 rows=51.00 loops=1) Workers Planned: 2 Workers Launched: 2 Buffers: shared hit=4307 -> Sort (cost=5162.85..5163.06 rows=84 width=238) (actual time=12.274..12.277 rows=21.00 loops=3) Sort Key: created_at, id Sort Method: quicksort Memory: 44kB Buffers: shared hit=4307 Worker 0: Sort Method: quicksort Memory: 27kB Worker 1: Sort Method: quicksort Memory: 30kB -> Parallel Seq Scan on messages (cost=0.00..5160.17 rows=84 width=238) (actual time=5.204..12.212 rows=25.00 loops=3) Filter: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3))) Rows Removed by Filter: 40348 Buffers: shared hit=4277 Planning: Buffers: shared hit=85 Planning Time: 0.565 ms Execution Time: 27.653 ms