Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/MariaDB/mysql-test/main/   (MariaDB Server Version 8.1-8.4©)  Datei vom 1.9.2026 mit Größe 4 kB image not shown  

Quelle  opt_hint_timeout.result   Sprache: Lisp

 

#
# MAX_EXECUTION_TIME hint testing
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 SELECT seq FROM seq_1_to_5000;
# Correct hint usage
SELECT /*+ MAX_EXECUTION_TIME(10) */* FROM t1 a, t1 b;
ERROR 70100: Query was interrupted: execution time limit 0.01 sec exceeded
EXPLAIN EXTENDED SELECT /*+ MAX_EXECUTION_TIME(0001490) */* FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5000 100.00 
Warnings:
Note 1003 select /*+ MAX_EXECUTION_TIME(0001490) */ `test`.`t1`.`a` AS `a` from `test`.`t1`
SELECT  /*+ MAX_EXECUTION_TIME(20) */ *, SLEEP(1) FROM t1 UNION SELECT 1, 2;
ERROR 70100: Query was interrupted: execution time limit 0.02 sec exceeded
(SELECT /*+ MAX_EXECUTION_TIME(300) */ *, SLEEP(1) FROM t1) UNION (SELECT 1, 2);
ERROR 70100: Query was interrupted: execution time limit 0.3 sec exceeded
((SELECT  /*+ MAX_EXECUTION_TIME(500) */ *, SLEEP(1) FROM t1));
ERROR 70100: Query was interrupted: execution time limit 0.5 sec exceeded
# Make sure the hint overrides global/session/statement settings.
# Global setting 30 seconds, won't be exceeded for sure
SET @@max_statement_time = 30;
SELECT /*+ MAX_EXECUTION_TIME(10)*/ count(*) FROM t1 a natural join t1 b natural join t1 c;
ERROR 70100: Query was interrupted: execution time limit 0.01 sec exceeded
# Session setting 30 seconds, too long to be exceeded
SET SESSION max_statement_time = 30;
SELECT /*+ MAX_EXECUTION_TIME(15) */ count(*) FROM t1 a natural join t1 b natural join t1 c;
ERROR 70100: Query was interrupted: execution time limit 0.015 sec exceeded
SET STATEMENT max_statement_time = 20 FOR
SELECT /*+ MAX_EXECUTION_TIME(5)*/ count(*) FROM t1 a natural join t1 b natural join t1 c;
ERROR 70100: Query was interrupted: execution time limit 0.005 sec exceeded
# Check that prepared statements process the hint correctly
PREPARE s FROM 'SELECT  /*+ MAX_EXECUTION_TIME(20) */ seq, SLEEP(1) FROM seq_1_to_10';
EXECUTE s;
ERROR 70100: Query was interrupted: execution time limit 0.02 sec exceeded
EXECUTE s;
ERROR 70100: Query was interrupted: execution time limit 0.02 sec exceeded
# Hint duplication
SELECT /*+ MAX_EXECUTION_TIME(50000) MAX_EXECUTION_TIME(100) */ count(*) FROM t1;
count(*)
5000
Warnings:
Warning 4219 Hint MAX_EXECUTION_TIME(100) is ignored as conflicting/duplicated
# Wrong values
SELECT /*+ MAX_EXECUTION_TIME(0) */ count(*) FROM t1;
count(*)
5000
Warnings:
Warning 1912 Incorrect value '0' for option 'MAX_EXECUTION_TIME'
SELECT /*+ MAX_EXECUTION_TIME(-1) */ count(*) FROM t1;
count(*)
5000
Warnings:
Warning 1064 Optimizer hint syntax error near '-1) */ count(*) FROM t1' at line 1
SELECT /*+ MAX_EXECUTION_TIME(4294967296) */ count(*) FROM t1;
count(*)
5000
Warnings:
Warning 1912 Incorrect value '4294967296' for option 'MAX_EXECUTION_TIME'

# only SELECT statements support the MAX_EXECUTION_TIME hint (warning):

CREATE TABLE t2 (i INT);
INSERT /*+ MAX_EXECUTION_TIME(10) */ INTO t2 SELECT 1;
Warnings:
Warning 4225 Optimizer hints at the INSERT part of a INSERT..SELECT statement are not supported
INSERT INTO t2 SELECT /*+ MAX_EXECUTION_TIME(10) */ 1;
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(10)' is not allowed in this context
REPLACE /*+ MAX_EXECUTION_TIME(15) */ INTO t2 SELECT 1;
Warnings:
Warning 4225 Optimizer hints at the INSERT part of a INSERT..SELECT statement are not supported
REPLACE INTO t2 SELECT /*+ MAX_EXECUTION_TIME(10) */ 1;
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(10)' is not allowed in this context
UPDATE /*+ MAX_EXECUTION_TIME(23) */ t2 SET i = 1;
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(23)' is not allowed in this context
DELETE /*+ MAX_EXECUTION_TIME(5000) */ FROM t2 WHERE i = 1;
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(5000)' is not allowed in this context
# Not supported inside stored procedures/functions
CREATE PROCEDURE p1() BEGIN SELECT /*+ MAX_EXECUTION_TIME(10) */ count(*) FROM t1 a, t1 b
INTO @a; END|
CALL p1();
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(10)' is not allowed in this context
DROP PROCEDURE p1;
# Hint in a subquery is not allowed (warning):
SELECT 1 FROM (SELECT /*+ MAX_EXECUTION_TIME(10) */ 1) a;
1
1
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(10)' is not allowed in this context
# Hint is allowed only for the first select of UNION (warning):
SELECT /*+ MAX_EXECUTION_TIME(50000) */ count(*) FROM t1
UNION
SELECT /*+ MAX_EXECUTION_TIME(3) */ count(*) FROM t1;
count(*)
5000
Warnings:
Warning 4219 Hint MAX_EXECUTION_TIME(3) is ignored as conflicting/duplicated
SELECT count(*) FROM t1
UNION
SELECT /*+ MAX_EXECUTION_TIME(30) */ count(*) FROM t1;
count(*)
5000
Warnings:
Warning 4172 'MAX_EXECUTION_TIME(30)' is not allowed in this context
# Check that hint actually works:
SELECT /*+ MAX_EXECUTION_TIME(20) */ count(*), SLEEP(1) FROM t1
UNION
SELECT count(*), SLEEP(1) FROM t1;
ERROR 70100: Query was interrupted: execution time limit 0.02 sec exceeded
DROP TABLE t1, t2;

Messung V0.5 in Prozent
C=67 H=100 G=84

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-10-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.