Skip to content

planner: set_var cannot take effect in UNION ALL statements #50068

@qw4990

Description

@qw4990

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (a int);
insert into t values (1);
insert into t values (1);

mysql> select /*+ set_var(max_execution_time=100) */ a, sleep(1) from t;
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded

mysql> select /*+ set_var(max_execution_time=100) */ a, sleep(1) from t union all select a, 1 from t;
+------+----------+
| a    | sleep(1) |
+------+----------+
|    1 |        1 |
|    1 |        1 |
|    1 |        0 |
|    1 |        0 |
+------+----------+
4 rows in set (2.01 sec)

2. What did you expect to see? (Required)

The second query should return an error.

3. What did you see instead (Required)

The second query's execution time exceeds the limitation.

The reason is that UNION ALL's node is not considered when extracting statement hints:

img_v3_026p_32b954e0-92b3-4a15-8aac-c847fca3026g

4. What is your TiDB version? (Required)

Master

Metadata

Metadata

Assignees

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.epic/hintreport/customerCustomers have encountered this bug.severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions