On 9/14/2011 1:04 AM, Marco Lanzotti wrote:
> Il 13/09/2011 20:58, Alex Nikitin ha scritto:
>> Correction on Marco's post. You can absolutely stop a mysql query
> I know I can stop a query, but I don't know how to realize HTTP client
> has closed connection during query execution.
> My query count how many records match selected fields in a 50M records
> Any query field is indexed and innodb uses 20GB of RAM to store data and
> indexes, but some queries take about 30 seconds to run.
> When user changes filters and asks for a new count, the old queries
> continue to run using DB resurces unnecessarily.
Well, from the sounds of that, you really do not have an easy option.
Here is my suggestion.
In your initial script, you could add a unique value to your SQL statement.
You SQL would be something like...
SELECT ... FROM ... WHERE ... AND (1=1 OR 'unique value');
add 'unique value' to your session data and then, when the person changes the
selected fields and starts to execute another query, first, you could search to
see if an SQL statement is running that has your unique value in it. if it
cannot find a matching statement, simply execute the SQL query. If it does find
an SQL statement that matches the unique value, kill it, then issue your SQL
Read the following to figure out how to find your unique process:
Read the following to find out how to kill your processes:
But, it does seem like it would be possible.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php