Re: SELECT very slow

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: SELECT very slow
Date: 2005-06-09 11:30:08
Message-ID: d89905$8c0$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 09.06.2005 02:06 Tom Lane wrote:

> Thomas Kellerer <spam_eater(at)gmx(dot)net> writes:
>
>>Is there anything I can do, to convince PG to return the first row more
>>quickly?
>
> The solution is to use a cursor and FETCH a reasonably small number of
> rows at a time.

Thanks for all your answers.

I turned out that I did not read the JDBC documentation closely enough (blush)

Setting the fetchSize to 1 (or something >0) only uses a cursor if autocommit is
disabled (due to the annoying "transaction is aborted" when running DDL scripts
that have errors, I usually turn autocommit on).

With autocommit off, the rows will be returned "immediately" (so the driver is
using a cursor to fetch the data)

Regards
Thomas

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dinesh Pandey 2005-06-10 07:10:39 Permission denied for language pltclu
Previous Message Andreas Kretschmer 2005-06-09 08:39:09 Re: [despammed] rejecting characters in a field