We can use SET MAX_EXECUTION_TIME=10; statement to stop the execution of a SELECT statement, if it took more than 10 milliseconds to execute the query. But the same wont work for other statements like CREATE TEMPORARY TABLE and INSERT etc.

Reference: https://dev.mysql.com/doc/refman/5.7/en/optimizer-hints.html#optimizer-hints-execution-time

Currently my temporary table creation takes more than 50s to complete. I want to put a limit like 10s. Is it possible in MySQL?

  • No such feature. Would you care to elaborate on your use case; maybe we can find a workaround. – Rick James Mar 12 '18 at 14:31
  • 1
    I need my query execution to stop when it took more than the specified time limit. This query can be SELECT, CREATE TABLE, etc. – Sarath S Nair Mar 13 '18 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.