Resolve "Slow queries continue running after php times out"
Closes #15 (closed)
PDO supports an ATTR_TIMEOUT
property ( https://www.php.net/manual/en/pdo.setattribute.php ). It appears the mysql driver does not use this for statement execution timeout, and session max_execution_time is the recommended workaround.
180 s
is a conservative default and can be tuned when deployed.
Did some basic testing on a local mysql:
SET SESSION MAX_EXECUTION_TIME=5000; -- 5000 ms = 5 s
SELECT SLEEP(6); -- 6 s => returns 1, timeout
SELECT SLEEP(4); -- 4 s => returns 0, no timeout
Edited by Jeremy M Fee