pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rainer Bauer <usenet@munnin.com>
To: pgsql-odbc@postgresql.org
Subject: Why is UseDeclareFetch so slow?
Date: Fri, 22 Jun 2007 17:06:11 +0200
Message-ID: <csln73hi8pu9rlglofd6rikde0ss9199fg@4ax.com> (raw)

Hello,

based on the problem I had here
<http://archives.postgresql.org/pgsql-performance/2007-06/msg00461.php;
I thought it would be interesting to know why UseDeclareFetch is slowing my
query down dramatically.

I have a table containing 50 tuples and retrieve all 50 tuples with a bound
column select statement:
SELECT * FROM tblItem WHERE intItemIDCnt = ?

This takes 8 seconds (over a slow DSL connection with 150ms ping). Tom Lane
suggested enabling UseDeclareFetch and the performance drop was significant:
Instead of 8 seconds, the query now takes 30-32 seconds. I also tested
enabling UseServerSidePrepare (without UseDeclareFetch) and the query was
executed in 7 seconds.

After rewriting the query to use an IN clause it now works perfect:
SELECT * FROM tblItem WHERE intItemIDCnt IN (...)
The result is retrieved in 400ms (UseServerSidePrepare=950ms and
UseDeclareFetch=1242ms).

The only thread I found discussing the UseDeclareFetch/UseServerSidePrepare
options was <http://archives.postgresql.org/pgsql-odbc/2006-10/msg00051.php;.

So my questions are
1) Is there any chance the driver itself could be enhanced like Dimitri
suggested here:
<http://archives.postgresql.org/pgsql-performance/2007-06/msg00512.php;?
2) When should UseServerSidePrepare be used?
3) When should UseDeclareFetch be used?

Rainer



view thread (5+ messages)  latest in thread

Message-ID: <csln73hi8pu9rlglofd6rikde0ss9199fg@4ax.com>
Permalink:  ../csln73hi8pu9rlglofd6rikde0ss9199fg@4ax.com/
Also on:    postgresql.org/message-id/csln73hi8pu9rlglofd6rikde0ss9199fg@4ax.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: usenet@munnin.com
  Subject: Re: Why is UseDeclareFetch so slow?
  In-Reply-To: <csln73hi8pu9rlglofd6rikde0ss9199fg@4ax.com>
  References: <csln73hi8pu9rlglofd6rikde0ss9199fg@4ax.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox