Recursive query slow on strange conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a performance/regression problem on a complicated query (placed into a function) when some tables are empty.

On Pg 11.6 the query takes 121ms
On Pg 12.2 it takes 11450ms

I first sent a message to the pgsql-bugs mailing list :

https://www.postgresql.org/message-id/16390-e9866af103d5a03a%40postgresql.org

But was redirected here. I was also told to post the actual problem, not a simplified version (called "toy tables" by Tom Lane).


This is the first line of the plan :

Sort (cost=812647915435832343755929914826593174290432.00..812652524250886044745873982078186103504896.00 rows=1843526021485360431505148111877616697344 width=1362) (actual time=1.443..1.443 rows=0 loops=1)

The database is (full) vacuumed and analyzed.

Since the query plan is more than 560 lines and the query itself ~400 lines, I'm not sure it's efficient to post everything in an email.

I have rather prepared a .backup of the database in custom format (made with PG 11.6), dropping all big unused tables so that it's ~500Kb. It is available here :

http://freesofts.thefreecat.org/sage11demo_simple.backup


In order to test the problem, you can just call :

select * from findcontracts('{13}',7,true);



If it is more convenient to post everything in an email, just let me know.

Thanks for your help.





[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux