Skip site navigation (1) Skip section navigation (2)

Why is UseDeclareFetch so slow?

From: Rainer Bauer <usenet(at)munnin(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Why is UseDeclareFetch so slow?
Date: 2007-06-22 15:06:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc

based on the problem I had here
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

The only thread I found discussing the UseDeclareFetch/UseServerSidePrepare
options was <>.

So my questions are
1) Is there any chance the driver itself could be enhanced like Dimitri
suggested here:
2) When should UseServerSidePrepare be used?
3) When should UseDeclareFetch be used?



pgsql-odbc by date

Next:From: Richard WesleyDate: 2007-06-25 16:28:34
Subject: Re: Using the PostgreSQL ODBC driver for another database
Previous:From: Mark Cave-AylandDate: 2007-06-22 08:29:44
Subject: Re: Proposal for new pgsqlODBC feature - hidingtables inaccessible to the current user

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group