Tommy Pham wrote:
On Thu, Mar 25, 2010 at 8:15 PM, Robert Cummings <> wrote:
Daevid Vincent wrote:

-----Original Message-----
From: Robert Cummings [] Sent: Thursday, March
25, 2010 7:16 PM

Daevid Vincent wrote:
If I have to wait 3 seconds for a page to render, that wait
is noticeable.
Dumb users will click refresh, and since (unbelievably in
this day and age)
PHP and mySQL don't know the user clicked 'stop' or 'refresh', and
therefore mySQL will execute the same query a second time. That's an
entirely different thread I've already ranted on about.
You may find the following enlightening:

Except there is no way to tell mySQL "cancel that last request/query".
Well, no graceful way.

We actually have a script that runs on a crontab and seeks and destroys
"long running" queries. As you may have guessed, just because a query
a long time, it's difficult to know if it's actually hung or just really
taking that long. So we do some smarts to compare against others and see
it seems like the same one and stuff like that. Not great, but sure stops
the load from shooting through the roof.

Again, not going into the rant I've done before. Look in the archives
2009-06-02 for "Why doesn't mySQL stop a query when the browser tab is
closed" for that thread and even more indepth info on the archives (same date and subject).
That's a good point about MySQL, and in fact PHP would probably keep running
too until MySQL returned.

Application and Templating Framework for PHP

What about 'SHOW FULL PROCESSLIST' and look through the 'INFO' for
that last matching query statement and kill the process?

This is possible but then you don't know whose query you are killing. A terminated PHP process or a actively running PHP process with a connected user awaiting output. However, you could track PHP process IDs and MySQL process IDs (via mysql_thread_id()) to know whose MySQL process you are killing.

Application and Templating Framework for PHP

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to