Mysql Query Timeout

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tweenerz
Forum Newbie
Posts: 1
Joined: Fri Jun 10, 2005 2:30 pm

Mysql Query Timeout

Post by tweenerz »

Is it possible to attach a timeout onto a mysql query - not just a connection. What is happening is that after a successful connection, a query may lock a table indefinately for whatever reason. Then the mysql queue starts to build up real fast. Is there a way to send a query, but force a timeout so that the browser doesn't hang and the query doesn't just sit in the queue until the server is rebooted, at which point all the queries in the queue are lost.

I am basically trying to build a fool-proof way of saving vital queries from being lost. Once the timeout is detected, I would probably log the query to a text fiel or something.

Thanks for any help. :P
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Mysql Query Timeout

Post by onion2k »

tweenerz wrote:I am basically trying to build a fool-proof way of saving vital queries from being lost. Once the timeout is detected, I would probably log the query to a text fiel or something.
Using transactions would be a better option, but it rather depends on the version of MySQL you're using.
Post Reply