Re: calling procedures is slow and consumes extra much memory against calling function
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Date: 2020-05-15T18:36:20Z
Lists: pgsql-hackers
Attachments
- plpgsql-call-fix.patch (text/x-patch) patch
Hi > The problem is in plpgsql implementation of CALL statement >> >> In non atomic case - case of using procedures from DO block, the >> expression plan is not cached, and plan is generating any time. This is >> reason why it is slow. >> >> Unfortunately, generated plans are not released until SPI_finish. >> Attached patch fixed this issue. >> > > But now, recursive calling doesn't work :-(. So this patch is not enough > Attached patch is working - all tests passed It doesn't solve performance, and doesn't solve all memory problems, but significantly reduce memory requirements from 5007 bytes to 439 bytes per one CALL Regards Pavel > > >> Regards >> >> Pavel >> >> >>> Regards >>> >>> Pavel >>> >>>
Commits
-
Fix memory leak in plpgsql's CALL processing.
- c1e044bb30f2 12.5 landed
- 13a1901bad47 11.10 landed
- f0e4ec74e452 13.1 landed
- a6b1f5365d58 14.0 landed