[HACKERS] Cache query implemented

From: Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz>
To: Jan Wieck <wieck(at)debis(dot)com>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: [HACKERS] Cache query implemented
Date: 2000-02-24 17:35:14
Message-ID: Pine.LNX.3.96.1000224175739.17426A-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 23 Feb 2000, Jan Wieck wrote:
>
> I don't see much complexity difference between one context
> per plan vs. one context for all. At least if we do it
> transparently inside of SPI_saveplan() and SPI_freeplan().
>

Well, I explore PG's memory context routines and is probably more
simple destroy mem context (than use feeeObject()) and create new context
for plan is simple too. (Jan, Hiroshi and PG's source convince me :-)

Today afternoon I rewrite query cache and now is implemented as
'context-per-plan'. It allows me write a 'DROP PLAN' command. We can use
this cache in SPI too, and create new command SPI_freeplan() (and stop
TopMemoryContext feeding).

Now, PREPARE/EXECUTE are ready to usage. See:

test=# prepare my_plan as select * from tab where id = $1 using int;
PREPARE
test=# execute my_plan using 2;
id | data
----+------
2 | aaaa
(1 row)

test=# drop plan my_plan;
DROP
test=# execute my_plan using 2;
ERROR: Plan with name 'my_plan' not exist


I still not sure with PREPARE/EXECUTE keywords, I vote for:

CREATE PLAN name AS query [ USING type, ... ]
EXECUTE PLAN name [ USING values, ... ]
DROP PLAN name

Comments? (Please. I really not SQL's standard guru...)

Karel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Keith G. Murphy 2000-02-24 18:16:04 Re: [GENERAL] Re: [HACKERS] TRANSACTIONS
Previous Message Tom Lane 2000-02-24 17:03:00 Re: [HACKERS] Re: [BUGS] First experiences with Postgresql 7.0