Limiting the Execution Time of a Query in MySQL

Published: 11 August 2024
on channel: Database Dive
29
0

This SQL tutorial for dummies will walk you through a way to limit the execution time of an SQL query.
The way has to do with a MySQL system variable called max_execution_time and this MySQL variable can be set with a SET statement (e.g. SET GLOBAL max_execution_time=X where X is the time in miliseconds) or inside of a SELECT statement like so:

SELECT
/*+ MAX_EXECUTION_TIME(X) */
*
FROM
`demo_table`
WHERE `column` = 'value';

/* After X miliseconds, the query will timeout. */

The time is set in miliseconds and this can be very useful for various purposes. Enjoy and make sure to subscribe to this SQL tutorial channel to see new tutorials on MySQL, Percona Server, MariaDB, PostgreSQL, SQL Server, TimescaleDB, and other database management systems!

Music:
Ocean Drive by Luke Bergs:   / bergscloud  
Creative Commons — Attribution-ShareAlike 3.0 Unported — CC BY-SA 3.0
Free Download / Stream: https://bit.ly/4dO5BD5
Music promoted by Audio Library https://bit.ly/3SyeVCE

#shorts #reels #coding #data #mysql #mariadb


Watch video Limiting the Execution Time of a Query in MySQL online without registration, duration hours minute second in high quality. This video was added by user Database Dive 11 August 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2 once and liked it people.