Long running db queries and the "STOP" button

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello list,

We are working on a project where we use PHP5 inside Apache2 and run very long running queries on mysql 5 and postgresql. A single query might run up to several minutes, and generally uses 100% CPU on the database server. So far everything is fine.

Now what happens, is that sometimes the user hits the stop / back button before the query completes and reissues a new one.
The result is that two queries are running on the database server, even though the results of the first query will never be used.
Furthermore as both queries are concurring for the CPU, the second query takes much longer than normal.

PHP will only realize that the connection was closed by the browser once the database query is completed, but not during the query itself.

What we are looking for is a way to cancel a running query immediately when the user hits the back / stop button on his browser.
We found no real solution for this problem in the usual places. 

Any ideas, thoughts or comments are very welcome!

Cheers,
Thomas

---------------------------------------------
Thomas Seiler
Ing. sys. com. dipl. EPFL
SWISSCOM AG
Innovations
Security and Service Management
Ostermundigenstrasse 93
CH - 3050 Bern
SWITZERLAND
 
Phone:  +41 (0)31 342 42 69
Mobile: +41 (0)79 427 97 26
Fax:    +41 (0)31 892 62 27

Thomas.Seiler@xxxxxxxxxxxx
http://www.swisscom.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux