Re: Performance regression when adding LIMIT 1 to a query

2025-04-07 Thread Costa Alexoglou
On Mon, Apr 7, 2025 at 4:06 PM Artur Zakirov wrote: > On Mon, 7 Apr 2025 at 14:45, Costa Alexoglou wrote: > > ... > > with a plan: > > ``` > > Gather Merge (cost=115584.47..118515.35 rows=25120 width=824) (actual > time=46.004..74.267 rows=29653 loops=1) > > Workers Planned: 2 > > Workers L

Re: Performance regression when adding LIMIT 1 to a query

2025-04-07 Thread Artur Zakirov
On Mon, 7 Apr 2025 at 14:45, Costa Alexoglou wrote: > ... > with a plan: > ``` > Gather Merge (cost=115584.47..118515.35 rows=25120 width=824) (actual > time=46.004..74.267 rows=29653 loops=1) > Workers Planned: 2 > Workers Launched: 2 > -> Sort (cost=114584.45..114615.85 rows=12560 widt

Performance regression when adding LIMIT 1 to a query

2025-04-07 Thread Costa Alexoglou
Hey folks, I faced an interesting regression and would love to have some help understanding why this happened. The postgres version if it's of any use is PostgreSQL 16.3 . The following query: ``` EXPLAIN ANALYZE SELECT "databases_metrics"."metrics" FROM "databases_metrics" WHERE ( "data