Limit (cost=6162.88..6165.20 rows=20 width=238) (actual time=12.515..16.342 rows=1.00 loops=1) Buffers: shared hit=4307 -> Gather Merge (cost=6162.88..6186.40 rows=202 width=238) (actual time=12.513..16.339 rows=1.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=8.455..8.456 rows=0.33 loops=3) Sort Key: created_at, id Sort Method: quicksort Memory: 25kB Buffers: shared hit=4307 Worker 0: Sort Method: quicksort Memory: 25kB Worker 1: Sort Method: quicksort Memory: 25kB -> Parallel Seq Scan on messages (cost=0.00..5160.17 rows=84 width=238) (actual time=7.451..8.415 rows=0.33 loops=3) Filter: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3))) Rows Removed by Filter: 40373 Buffers: shared hit=4277 Planning: Buffers: shared hit=85 Planning Time: 0.289 ms Execution Time: 16.395 ms