File: opt_hint_timeout.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (73 lines) | stat: -rw-r--r-- 3,284 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# WL#8017 Infrastructure for Optimizer Hints
# MAX_EXECUTION_TIME hint testing
# MAX_EXECUTION_TIME hint testing
CREATE TABLE t1 (a INT, b VARCHAR(300));
INSERT INTO t1 VALUES (1, 'string');
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
SELECT /*+ MAX_EXECUTION_TIME(1) */ * FROM t1 a, t1 b;
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
EXPLAIN SELECT /*+ MAX_EXECUTION_TIME(10) MAX_EXECUTION_TIME(100) */ * FROM t1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	2048	100.00	NULL
Warnings:
Warning	3126	Hint MAX_EXECUTION_TIME(100) is ignored as conflicting/duplicated
Note	1003	/* select#1 */ select /*+ MAX_EXECUTION_TIME(10) */ `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
DROP TABLE t1;

# test the MAX_EXECUTION_TIME hint for SELECT statements:

CREATE TABLE t1 (i INT, j INT);
CREATE INDEX i1 ON t1(i);
CREATE INDEX i2 ON t1(j);
INSERT INTO t1 VALUES (1, 1), (2, 2);
SELECT /*+ MAX_EXECUTION_TIME(4294967296) */ 1 FROM t1;
1
1
1
Warnings:
Warning	1064	Unsupported MAX_EXECUTION_TIME near ') */ 1 FROM t1' at line 1
SELECT /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1;
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
SELECT  /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1 UNION SELECT 1, 2, 3;
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
(SELECT /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1) UNION (SELECT 1, 2, 3);
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
((SELECT  /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1));
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded

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

CREATE TABLE t2 (i INT);
INSERT /*+ MAX_EXECUTION_TIME(1) */ INTO t2 SELECT 1;
Warnings:
Warning	3125	MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only
REPLACE /*+ MAX_EXECUTION_TIME(1) */ INTO t2 SELECT 1;
Warnings:
Warning	3125	MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only
UPDATE /*+ MAX_EXECUTION_TIME(1) */ t2 SET i = 1;
Warnings:
Warning	3125	MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only
DELETE /*+ MAX_EXECUTION_TIME(1) */ FROM t2 WHERE i = 1;
Warnings:
Warning	3125	MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only
DROP TABLE t1, t2;
SELECT 1 FROM (SELECT /*+ MAX_EXECUTION_TIME(10) */ 1) a;
1
1
Warnings:
Warning	3125	MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only
CREATE FUNCTION f1() RETURNS INT BEGIN SELECT /*+ MAX_EXECUTION_TIME(10) */ 1
INTO @a; RETURN 1; END|
Warnings:
Warning	3125	MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only
DROP FUNCTION f1;