Hi,
Le 16 juil. 09 à 11:52, Andres Freund a écrit :
> If I interpret those findings correcty the execution is approx. as
> fast as DB2,
> only DB2 is doing automated plan caching while pg is not.
>
> If it _really_ is necessary that this is that fast, you can prepare
> the query
> like I showed.
A form of automatic plan caching by PostgreSQL is possible and
available as an extension called "preprepare", which aims to have your
statements already prepared by the time you're able to send queries
in, at which point you simply EXECUTE and never care about the PREPARE
in your code.
http://preprepare.projects.postgresql.org/README.html
The module is only available for PostgreSQL 8.3 or 8.4, and works in a
fully automatic manner only in 8.4 (using local_preload_librairies),
and in both cases requires you to:
- edit postgresql.conf and restart if preloading, else reload
- put your full PREPARE statements into a table
- psql -c "EXECUTE myquery;" mydb
- enjoy
Regards,
--
dim
PS: soon to be in debian sid for both 8.3 and 8.4, currently in NEW
queue