SET statement_timeout problem

From: "Hardwick, Joe" <Joe(dot)Hardwick(at)fnis(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SET statement_timeout problem
Date: 2010-01-28 21:42:34
Message-ID: 1D134C5F69F974449CCE35EFBA14205B04F8135A@CMBFISLTC01.FNFIS.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

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;

The open join, 1000ms, and 1000000 count are all intentional. Normally
those values would be 300000 and 10000. The accounts and individual
tables have around 100 fields and 500k records each.

Nested Loop (cost=21992.28..8137785497.71 rows=347496704100 width=8)
-> Seq Scan on accounts (cost=0.00..30447.44 rows=623844 width=8)
-> Materialize (cost=21992.28..29466.53 rows=557025 width=0)
-> Seq Scan on individual (cost=0.00..19531.25 rows=557025
width=0)

I tried moving the SET statment before the cursor delcaration and
outside the transaction with the same results. I thought possibly it
was getting bogged down in I/O but the timeout seems to work fine if not
using a cursor.

What am I missing here?

Thanks,
Joe

_____________

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
_____________

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Smith 2010-01-28 22:05:29 Re: Amazon EC2 CPU Utilization
Previous Message Mike Bresnahan 2010-01-28 19:02:28 Re: Amazon EC2 CPU Utilization

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2010-01-28 21:50:25 Re: SQL question re aggregates & joins
Previous Message Scott Ribe 2010-01-28 21:32:49 SQL question re aggregates & joins