Re: One-Shot Plans - Mailing list pgsql-hackers

From Jaime Casanova
Subject Re: One-Shot Plans
Date
Msg-id BANLkTi==9E3cPeBXAXTd-fUOxSzQKPyqGg@mail.gmail.com
Whole thread Raw
In response to One-Shot Plans  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On Tue, Jun 14, 2011 at 1:25 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
>
> We can work out the various paths through the traffic cop to see when
> a plan will be a "one-shot" - planned and then executed immediately,
> then discarded.
>
> In those cases we can take advantage of better optimisations. Most
> interestingly, we can evaluate stable functions at plan time, to allow
> us to handle partitioning and partial indexes better.
>
> Patch attached. Works...
>

this breaks test guc.c for me... specifically the test at
src/test/regress/sql/guc.sql circa line 226:
"""
set work_mem = '3MB';

-- but SET isn't
create or replace function myfunc(int) returns text as $$
begin set work_mem = '2MB'; return current_setting('work_mem');
end $$
language plpgsql
set work_mem = '1MB';

select myfunc(0), current_setting('work_mem');
"""

regressions.diff
"""
*** 656,662 **** select myfunc(0), current_setting('work_mem');  myfunc | current_setting --------+-----------------
!  2MB    | 2MB (1 row)
 set work_mem = '3MB';
--- 656,662 ---- select myfunc(0), current_setting('work_mem');  myfunc | current_setting --------+-----------------
!  2MB    | 3MB (1 row)
 set work_mem = '3MB';
"""

it seems that the effect of SET is being discarded

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Fwd: Keywords in pg_hba.conf should be field-specific
Next
From: Stefan Keller
Date:
Subject: hstore - Implementation and performance issues around its operators