Re: second CTE kills perf

2021-06-24 Thread Nicolas Seinlet
Hi, thanks for all. I replaced row_number() with some computed int which speeds up a lot the query. ‐‐‐ Original Message ‐‐‐ On Tuesday, June 22nd, 2021 at 15:53, Tom Lane wrote: > Nicolas Seinlet nico...@seinlet.com writes: > > > I'm trying to understand this behaviour and the limi

Re: second CTE kills perf

2021-06-22 Thread Tom Lane
Nicolas Seinlet writes: > I'm trying to understand this behaviour and the limits of CTE, when they > reach the limits, when they cannot receive parameters from a caller, ... I'm > running a query on PostgreSQL 10 with a cte. the query runs in ~ 10 seconds. > If I add a second CTE with the same

Re: second CTE kills perf

2021-06-22 Thread Vijaykumar Jain
On Tue, 22 Jun 2021 at 13:50, Nicolas Seinlet wrote: > Hello, > > oversimplified example: > 10 seconds version: > | WITH cte1 AS (SELECT x,y,z FROM table) SELECT row_number() over(),x,y,z > FROM cte1 WHERE x=32; > > 10 minutes version: > | WITH cte1 AS (SELECT x,y,z FROM table), cte2 AS (SELECT r

second CTE kills perf

2021-06-22 Thread Nicolas Seinlet
Hello, I'm trying to understand this behaviour and the limits of CTE, when they reach the limits, when they cannot receive parameters from a caller, ... I'm running a query on PostgreSQL 10 with a cte. the query runs in ~ 10 seconds. If I add a second CTE with the same query as the previous one