pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Query Timeout Question
4+ messages / 3 participants
[nested] [flat]

* Query Timeout Question
@ 2011-12-09 01:44 feng.zhou <feng.zhou@wellintech.com>
  2011-12-09 01:58 ` Re: Query Timeout Question feng.zhou <feng.zhou@wellintech.com>
  2011-12-09 02:27 ` Re: Query Timeout Question Craig Ringer <ringerc@ringerc.id.au>
  2011-12-09 02:51 ` Re: Re: [SQL] Query Timeout Question =?utf-8?B?ZmVuZy56aG91?= <feng.zhou@wellintech.com>
  0 siblings, 3 replies; 4+ messages in thread

From: feng.zhou @ 2011-12-09 01:44 UTC (permalink / raw)
  To: pgsql-sql

Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .

SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0 ) ;
SQLExecute(StatementHandle);

But I find this setting has no effect.Before adding timeout setting, SQLExecute costs 47 seconds.After adding timeout, costing time is same.
Postgres SQL version 8.4.2, ODBC driver 8.4.2

2011-12-09 



feng.zhou 

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Query Timeout Question
  2011-12-09 01:44 Query Timeout Question feng.zhou <feng.zhou@wellintech.com>
@ 2011-12-09 01:58 ` feng.zhou <feng.zhou@wellintech.com>
  2 siblings, 0 replies; 4+ messages in thread

From: feng.zhou @ 2011-12-09 01:58 UTC (permalink / raw)
  To: pgsql-sql

sorry, timeout is 15 seconds


2011-12-09 



feng.zhou 



发件人: feng.zhou 
发送时间: 2011-12-09  09:25:49 
收件人: pgsql-sql 
抄送: 
主题: [SQL] Query Timeout Question 
 
Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .

SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0 ) ;
SQLExecute(StatementHandle);

But I find this setting has no effect.Before adding timeout setting, SQLExecute costs 47 seconds.After adding timeout, costing time is same.
Postgres SQL version 8.4.2, ODBC driver 8.4.2

2011-12-09 



feng.zhou 


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Query Timeout Question
  2011-12-09 01:44 Query Timeout Question feng.zhou <feng.zhou@wellintech.com>
@ 2011-12-09 02:27 ` Craig Ringer <ringerc@ringerc.id.au>
  2 siblings, 0 replies; 4+ messages in thread

From: Craig Ringer @ 2011-12-09 02:27 UTC (permalink / raw)
  To: feng.zhou <feng.zhou@wellintech.com>; +Cc: pgsql-sql

On 12/09/2011 09:44 AM, feng.zhou wrote:
> Hi
> I set query timeout in code by using SQLSetStmtAttr ODBC API .
> SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0 ) 
> ;
> SQLExecute(StatementHandle);
> But I find this setting has no effect.Before adding timeout setting, 
> SQLExecute costs 47 seconds.After adding timeout, costing time is same.

First: You're using a very old patch release with known bugs. Update to 
8.4.10 .

As for the timeout: PostgreSQL doesn't support query timeouts. It 
supports a session-level statement timeout. I don't know whether the 
ODBC driver uses that or not. Examine the ODBC `mylog' output after 
enabling psqlODBC debugging, and examine the server log after turning on 
query logging, so you can see what the ODBC driver actually asks the 
server for when you set a query timeout.

--
Craig Ringer

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Re: [SQL] Query Timeout Question
  2011-12-09 01:44 Query Timeout Question feng.zhou <feng.zhou@wellintech.com>
@ 2011-12-09 02:51 ` =?utf-8?B?ZmVuZy56aG91?= <feng.zhou@wellintech.com>
  2 siblings, 0 replies; 4+ messages in thread

From: feng.zhou @ 2011-12-09 02:51 UTC (permalink / raw)
  To: Craig Ringer <ringerc@ringerc.id.au>; +Cc: pgsql-sql

Thanks for your reply.
if timeout setting doesn't be supported, How to solve this question that the client is hung for long time when executing time-comsuming query or query a locked table.


2011-12-09 



feng.zhou 



发件人: Craig Ringer 
发送时间: 2011-12-09  10:05:44 
收件人: feng.zhou 
抄送: pgsql-sql 
主题: Re: [SQL] Query Timeout Question 
 
On 12/09/2011 09:44 AM, feng.zhou wrote: 
Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .

SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0 ) ;
SQLExecute(StatementHandle);

But I find this setting has no effect.Before adding timeout setting, SQLExecute costs 47 seconds.After adding timeout, costing time is same.

First: You're using a very old patch release with known bugs. Update to 8.4.10 .

As for the timeout: PostgreSQL doesn't support query timeouts. It supports a session-level statement timeout. I don't know whether the ODBC driver uses that or not. Examine the ODBC `mylog' output after enabling psqlODBC debugging, and examine the server log after turning on query logging, so you can see what the ODBC driver actually asks the server for when you set a query timeout.

--
Craig Ringer


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2011-12-09 02:51 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 01:44 Query Timeout Question feng.zhou <feng.zhou@wellintech.com>
2011-12-09 01:58 ` feng.zhou <feng.zhou@wellintech.com>
2011-12-09 02:27 ` Craig Ringer <ringerc@ringerc.id.au>
2011-12-09 02:51 ` =?utf-8?B?ZmVuZy56aG91?= <feng.zhou@wellintech.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox