Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1 - Mailing list pgsql-performance

From Dimitri Fontaine
Subject Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1
Date
Msg-id FF8BF3BA-E520-43D4-B69A-FDD647A829C6@hi-media.com
Whole thread Raw
In response to Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1  (Andres Freund <andres@anarazel.de>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: cluster index on a table
Next
From: Greg Stark
Date:
Subject: Re: cluster index on a table