Re: statement_timeout problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hardwick, Joe" <Joe(dot)Hardwick(at)fnis(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: statement_timeout problem
Date: 2010-02-02 00:31:18
Message-ID: 19923.1265070678@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Hardwick, Joe" <Joe(dot)Hardwick(at)fnis(dot)com> writes:
> I have a problem with fetching from cursors sometimes taking an
> extremely long time to run. I am attempting to use the
> statement_timeout parameter to limit the runtime on these.

> PostgreSQL 8.2.4
> Linux 2.6.22.14-72.fc6 #1 SMP Wed Nov 21 13:44:07 EST 2007 i686 i686
> i386 GNU/Linux

> begin;
> set search_path = testdb;
> declare cur_rep cursor for select * from accounts, individual;

> set statement_timeout = 1000;

> fetch forward 1000000 from cur_rep;

Works for me --- the FETCH fails after just about a second of execution.

I suspect the problem is lack of a CHECK_FOR_INTERRUPTS someplace, which
probably got added sometime after 8.2.4 (I checked 8.2 branch tip).
I'd suggest updating to 8.2.something-recent.

If you still see the problem in latest 8.2.x then we need to look closer
to figure out why the difference in results.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2010-02-02 01:11:13 reducing result set of tsvector @@ tsquery avoiding to use ts_rank
Previous Message Tom Lane 2010-02-02 00:19:46 Re: Locking referenced table when creating and dropping tables with foreign key constraints