From: | "James Pang (chaolpan)" <chaolpan(at)cisco(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org> |
Subject: | RE: thousands of CachedPlan entry per backend |
Date: | 2023-06-02 09:06:12 |
Message-ID: | PH0PR11MB51914B352168E8E8A7CD0A22D64EA@PH0PR11MB5191.namprd11.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
these lines about "SPI Plan" are these PL/PGSQL functions related through SPI_prepare plan entry, right?
SPI Plan: 1024 total in 1 blocks; 600 free (0 chunks); 424 used
CachedPlan: 2048 total in 2 blocks; 304 free (1 chunks); 1744 used: xxxxxxx
CachedPlanSource: 2048 total in 2 blocks; 200 free (0 chunks); 1848 used: xxxxxxx
CachedPlanQuery: 2048 total in 2 blocks; 704 free (0 chunks); 1344 used
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Sent: Friday, June 2, 2023 12:57 PM
To: James Pang (chaolpan) <chaolpan(at)cisco(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>; pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: thousands of CachedPlan entry per backend
pá 2. 6. 2023 v 3:45 odesílatel James Pang (chaolpan) <chaolpan(at)cisco(dot)com<mailto:chaolpan(at)cisco(dot)com>> napsal:
these lines about "SPI Plan" are these PL/PGSQL functions related SPI_prepare plan entry, right? Possible to set a GUC to max(cached plan) per backend ?
There is no limit for size of system cache. You can use pgbouncer that implicitly refresh session after 1 hour (and this limit can be reduced)
Regards
Pavel
SPI Plan: 1024 total in 1 blocks; 600 free (0 chunks); 424 used
CachedPlan: 2048 total in 2 blocks; 304 free (1 chunks); 1744 used: xxxxxxx
CachedPlanSource: 2048 total in 2 blocks; 200 free (0 chunks); 1848 used: xxxxxxx
CachedPlanQuery: 2048 total in 2 blocks; 704 free (0 chunks); 1344 used
Thanks,
James
-----Original Message-----
From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at<mailto:laurenz(dot)albe(at)cybertec(dot)at>>
Sent: Thursday, June 1, 2023 8:48 PM
To: James Pang (chaolpan) <chaolpan(at)cisco(dot)com<mailto:chaolpan(at)cisco(dot)com>>; Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com<mailto:pavel(dot)stehule(at)gmail(dot)com>>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org<mailto:pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: thousands of CachedPlan entry per backend
On Thu, 2023-06-01 at 08:50 +0000, James Pang (chaolpan) wrote:
> we found thousands of cached plan , since JDBC driver only allow max
> 256 cached prepared statements, how backend cache so many sql plans.
> If we have one function, when application call that function will make
> backend to cache every SQL statement plan in that function too? and for table triggers, have similar caching behavior ?
Yes, as long as the functions are written in PL/pgSQL.
It only affects static SQL, that is, nothing that is run with EXECUTE.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2023-06-02 19:17:13 | Re: thousands of CachedPlan entry per backend |
Previous Message | Pavel Stehule | 2023-06-02 04:56:51 | Re: thousands of CachedPlan entry per backend |