I have a mysqli_query()
in a PHP script which usually takes about 10 ms to finish. However, sometimes it takes about 5000 ms. This query isn't important for the site to function properly, i.e. it can be ignored if it takes for more than 10 ms.
Is this possible to do?
Something like:
<?php
// microtime here is X
$query = mysqli_query($connection, "(do something)");
// if difference between time now and previous time is bigger than 10 ms,
// skip waiting for the $query result and go on
?>
If anything like this is possible, can we also cancel the running query, so that MySQL server knows we don't want the result anymore and stops processing it?