"Hardwick, Joe" <Joe.Hardwick@fnis.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