Re: Plan caching and serialization for reuse across executions

2025-08-18 Thread Andrei Lepikhov
On 18/8/2025 16:18, Tom Lane wrote: Andrei Lepikhov writes: I wouldn't recommend this obsolete version of the extension. Since the QueryId was introduced, we have redesigned it extensively, with the basic idea that QueryId serves as a 'query plan class' and that matching parse trees provide a p

Re: Plan caching and serialization for reuse across executions

2025-08-18 Thread Julien Rouhaud
Hi, On Mon, Aug 18, 2025 at 10:18:34AM -0400, Tom Lane wrote: > Andrei Lepikhov writes: > > I wouldn't recommend this obsolete version of the extension. Since the > > QueryId was introduced, we have redesigned it extensively, with the > > basic idea that QueryId serves as a 'query plan class' and

Re: Plan caching and serialization for reuse across executions

2025-08-18 Thread Tom Lane
Andrei Lepikhov writes: > I wouldn't recommend this obsolete version of the extension. Since the > QueryId was introduced, we have redesigned it extensively, with the > basic idea that QueryId serves as a 'query plan class' and that matching > parse trees provide a proof of matching incoming qu

Re: Plan caching and serialization for reuse across executions

2025-08-18 Thread Andrei Lepikhov
On 16/8/2025 14:32, Xuan Chen wrote: Hi hackers, I am currently exploring whether it is possible to cache a plan generated by the PostgreSQL planner and reuse it across later executions. I understand that there are existing mechanisms like PREPARE/EXECUTE and CachedPlan in plancache.c, but th

Re: Plan caching and serialization for reuse across executions

2025-08-18 Thread Andrei Lepikhov
On 18/8/2025 13:50, Kirill Reshke wrote: Hi! On Sun, 17 Aug 2025 at 23:34, Xuan Chen wrote: - Any relevant references in the source code (planner, plancache.c, executor) that I should study would be very helpful. Here is extension implementing saving and restoring plans[0] [0]https://git

Re: Plan caching and serialization for reuse across executions

2025-08-18 Thread Kirill Reshke
Hi! On Sun, 17 Aug 2025 at 23:34, Xuan Chen wrote: > > - Any relevant references in the source code (planner, plancache.c, executor) > that I should study would be very helpful. Here is extension implementing saving and restoring plans[0] [0]https://github.com/postgrespro/sr_plan -- Best re

Plan caching and serialization for reuse across executions

2025-08-17 Thread Xuan Chen
Hi hackers, I am currently exploring whether it is possible to cache a plan generated by the PostgreSQL planner and reuse it across later executions. I understand that there are existing mechanisms like PREPARE/EXECUTE and CachedPlan in plancache.c, but these are tied to prepared statements and