Cache query (PREPARE/EXECUTE)

Поиск
Список
Период
Сортировка
От Karel Zak - Zakkr
Тема Cache query (PREPARE/EXECUTE)
Дата
Msg-id Pine.LNX.3.96.1000222160403.23918A-100000@ara.zf.jcu.cz
обсуждение исходный текст
Ответы Re: [HACKERS] Cache query (PREPARE/EXECUTE)  (The Hermit Hacker <scrappy@hub.org>)
Re: [HACKERS] Cache query (PREPARE/EXECUTE)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@zf.jcu.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)
-----------------------------------------------------------------------



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vince Vielhaber
Дата:
Сообщение: Re: [HACKERS] Beta for 4:30AST ... ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Re: [PATCHES] Patch for more readable parse error messages