Re: Postgres 17.4 is much slower than Postgres 15.12 using RECURSIVE

From: marcos sicat <marcos(dot)sicat(at)atlasifs(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres 17.4 is much slower than Postgres 15.12 using RECURSIVE
Date: 2025-04-30 21:43:43
Message-ID: MW5PR84MB2227FC185274F5C09423D596F2832@MW5PR84MB2227.NAMPRD84.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I was able to capture the Qplans for both, and I highlighted the differences in red. Are there server settings differences between v17 and v15 by default?

What would be the suggested configuration settings in v17 that would behave like v15 and match the performance with v15?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Date: Tuesday, April 29, 2025 at 1:01 AM
To: marcos sicat <marcos(dot)sicat(at)atlasifs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres 17.4 is much slower than Postgres 15.12 using RECURSIVE

Hi

po 28. 4. 2025 v 23:53 odesílatel marcos sicat <marcos(dot)sicat(at)atlasifs(dot)com<mailto:marcos(dot)sicat(at)atlasifs(dot)com>> napsal:
Thanks, Tom.

After you made your recommendation, the result returned much quicker at 2.62 seconds, but v15 is still faster at 1.82 seconds. No modification was made to the function.

and you look at the log file and separate query plans from there.

proposed changes just force storing query plans to the log file.

From plans we can see what is different

Regards

Pavel

[image.png]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>>
Date: Monday, April 28, 2025 at 9:59 AM
To: marcos sicat <marcos(dot)sicat(at)atlasifs(dot)com<mailto:marcos(dot)sicat(at)atlasifs(dot)com>>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com<mailto:pavel(dot)stehule(at)gmail(dot)com>>, pgsql-bugs(at)lists(dot)postgresql(dot)org<mailto:pgsql-bugs(at)lists(dot)postgresql(dot)org> <pgsql-bugs(at)lists(dot)postgresql(dot)org<mailto:pgsql-bugs(at)lists(dot)postgresql(dot)org>>
Subject: Re: Postgres 17.4 is much slower than Postgres 15.12 using RECURSIVE

marcos sicat <marcos(dot)sicat(at)atlasifs(dot)com<mailto:marcos(dot)sicat(at)atlasifs(dot)com>> writes:
> The function is the same between v15 and v17. Is there a subtle difference in performance for nested subqueries in v17?

Your next step should be to compare the plans for the function's
query. The auto_explain or pg_stat_statements extensions could
be used to check that in-situ, if manually EXPLAINing that query
doesn't yield insight.

regards, tom lane

Attachment Content-Type Size
postgres_v17_qplan_v15_qplan.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet 13.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-04-30 21:56:04 Re: Doubt in reset date style
Previous Message David G. Johnston 2025-04-30 21:31:11 Re: Doubt in reset date style