Sometimes I need to run a long query.
Or sometimes when running one using TablePlus and it is taking a long time the kill process doesn’t always work.
You can set a timeout with this syntax in your select /*+ MAX_EXECUTION_TIME(2000) */
. The time is in milliseconds.
This is a part of the mysql optimizer hints and there’s lots more to set.
Something like this:
SELECT
/*+ MAX_EXECUTION_TIME(2000) */ -- in milliseconds
prescription.id
FROM
prescription
JOIN prescription_model ON prescription.id = prescription_model.prescription_id
WHERE
prescription.id < 1000000
and prescription_model.model LIKE "%Distal Finger Spring%"