74 lines
3.2 KiB
Plaintext
74 lines
3.2 KiB
Plaintext
# 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;
|