Timing is on. Time: 10.952 ms COMPOSITE INDEX QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.42..5.93 rows=50 width=46) (actual time=0.028..0.041 rows=50 loops=1) Buffers: shared hit=1 read=4 -> Index Scan using idx_messages_chat_created_id on messages (cost=0.42..10839.86 rows=98331 width=46) (actual time=0.027..0.037 rows=50 loops=1) Index Cond: (chat_id = 'f68eff95-e44f-4c79-997c-49eb725cfb4d'::uuid) Buffers: shared hit=1 read=4 Planning: Buffers: shared hit=14 Planning Time: 0.060 ms Execution Time: 0.048 ms (9 rows) Time: 0.417 ms BEGIN Time: 0.106 ms DROP INDEX Time: 0.657 ms SINGLE COLUMN INDEX QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=5430.38..5436.13 rows=50 width=46) (actual time=12.333..13.504 rows=50 loops=1) Buffers: shared hit=182 read=1475 -> Gather Merge (cost=5430.38..12082.21 rows=57842 width=46) (actual time=12.331..13.500 rows=50 loops=1) Workers Planned: 1 Workers Launched: 1 Buffers: shared hit=182 read=1475 -> Sort (cost=4430.37..4574.98 rows=57842 width=46) (actual time=11.217..11.219 rows=50 loops=2) Sort Key: created_at, id Sort Method: top-N heapsort Memory: 28kB Buffers: shared hit=182 read=1475 Worker 0: Sort Method: top-N heapsort Memory: 28kB -> Parallel Seq Scan on messages (cost=0.00..2508.90 rows=57842 width=46) (actual time=0.009..7.022 rows=45002 loops=2) Filter: (chat_id = 'f68eff95-e44f-4c79-997c-49eb725cfb4d'::uuid) Rows Removed by Filter: 16293 Buffers: shared hit=138 read=1475 Planning: Buffers: shared hit=4 Planning Time: 0.052 ms Execution Time: 13.525 ms (19 rows) Time: 13.780 ms ROLLBACK Time: 0.088 ms ORIGINAL INDEX RESTORED