Cache query (PREPARE/EXECUTE)

From: Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz>
To: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Cache query (PREPARE/EXECUTE)
Date: 2000-02-22 15:48:35
Message-ID: Pine.LNX.3.96.1000222160403.23918A-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,

as I said, I tring implement PREPARE / EXECUTE command for user a
controllable query cache (in TODO: Cache most recent query plan(s)).

I have implement first usable version now (I know that it is not
interesting for current feature-freeze state, but I believe that
it is interesting for next release and for major developers). See:

test=# prepare sel as select * from tab where id = $1 and data
like $2 using int, text;
PREPARE
test=# execute sel using 1, '%a';
id | data
----+------
1 | aaaa
(1 row)

test=# prepare ins as insert into tab (data) values($1) using text;
PREPARE
test=# execute ins_tab using 'cccc';
INSERT 18974 1

The queryTree and planTree are save in hash table and in the
TopMemoryContext (Is it good space for this cache?). All is
without change-schema detection (IMHO is user problem if he
changes DB schema and use old cached plan). In future I try
add any 'change-schema' detection (to alter/drop table,rule..etc).

I'am not sure with syntax, now is:

PREPARE name AS optimizable-statement [ USING type, ... ]
EXECUTE name [ USING value, ... ]

Comments? Suggestions? (SQL92?)

(Note: I try test speed and speed for cached query plan (select) executed
via EXECUTE rise very very up (70% !).)

Karel


----------------------------------------------------------------------
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> http://home.zf.jcu.cz/~zakkr/

Docs: http://docs.linux.cz (big docs archive)
Kim Project: http://home.zf.jcu.cz/~zakkr/kim/ (process manager)
FTP: ftp://ftp2.zf.jcu.cz/users/zakkr/ (C/ncurses/PgSQL)
-----------------------------------------------------------------------

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-02-22 15:50:03 Re: [HACKERS] Re: [PATCHES] Patch for more readable parse error messages
Previous Message Vince Vielhaber 2000-02-22 15:46:06 Re: [HACKERS] Beta for 4:30AST ... ?