Thursday, September 21, 2023
HomeSoftware EngineeringFind out how to Abort SQL statements after a set time in...

Find out how to Abort SQL statements after a set time in MariaDB


Generally you don’t need a SELECT question to run for greater than a set period of time.

This can be a roundabout strategy to make your server doesn’t die from slow-running queries.

Clearly, it is best to tweak your database and doubtlessly run your SELECT queries by an EXPLAIN plan first. This lets you create applicable indexes and discover why issues are sluggish within the first place.

However: generally you continue to end up desirous to kill queries that will run over a sure period of time.

Find out how to abort sluggish queries

Your unique question:

SELECT b.area as area ...

Your new question:

SET STATEMENT max_statement_time=30 FOR SELECT b.area as area ...

Discover the addition of the SET STATEMENT max_statement_time=30 proper earlier than the SELECT.

That is measured in seconds, so the above question will robotically be killed after 30 seconds.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments