Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: ning <mailxiening(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1
Date: 2009-07-16 20:43:29
Message-ID: FF8BF3BA-E520-43D4-B69A-FDD647A829C6@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Stark 2009-07-16 20:49:26 Re: cluster index on a table
Previous Message Kevin Grittner 2009-07-16 20:14:43 Re: cluster index on a table