Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"merge" hint in CTE with view will not work #36666

Closed
seiya-annie opened this issue Jul 28, 2022 · 2 comments · Fixed by #36678
Closed

"merge" hint in CTE with view will not work #36666

seiya-annie opened this issue Jul 28, 2022 · 2 comments · Fixed by #36678
Assignees
Labels
affects-6.2 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@seiya-annie
Copy link

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);
create view v as select * from t;
explain with cte as (select /+merge()/ * from v) select * from cte;

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

merge in cte works

3. What did you see instead (Required)

mysql> explain with cte as (select * from v) select * from cte;
+--------------------------------+---------+-----------+---------------+--------------------------------+
| id                             | estRows | task      | access object | operator info                  |
+--------------------------------+---------+-----------+---------------+--------------------------------+
| CTEFullScan_11                 | 1.00    | root      | CTE:cte       | data:CTE_0                     |
| CTE_0                          | 1.00    | root      |               | Non-Recursive CTE              |
| └─TableReader_9(Seed Part)     | 1.00    | root      |               | data:TableFullScan_8           |
|   └─TableFullScan_8            | 1.00    | cop[tikv] | table:t       | keep order:false, stats:pseudo |
+--------------------------------+---------+-----------+---------------+--------------------------------+
4 rows in set (0.00 sec)

mysql> explain with cte as (select /*+merge()*/ * from v) select * from cte;
+--------------------------------+---------+-----------+---------------+--------------------------------+
| id                             | estRows | task      | access object | operator info                  |
+--------------------------------+---------+-----------+---------------+--------------------------------+
| CTEFullScan_11                 | 1.00    | root      | CTE:cte       | data:CTE_0                     |
| CTE_0                          | 1.00    | root      |               | Non-Recursive CTE              |
| └─TableReader_9(Seed Part)     | 1.00    | root      |               | data:TableFullScan_8           |
|   └─TableFullScan_8            | 1.00    | cop[tikv] | table:t       | keep order:false, stats:pseudo |
+--------------------------------+---------+-----------+---------------+--------------------------------+
4 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

| Release Version: v6.2.0
Edition: Community
Git Commit Hash: 65f7e2e
Git Branch: heads/refs/tags/v6.2.0
UTC Build Time: 2022-07-27 10:10:50
GoVersion: go1.18.2

@seiya-annie seiya-annie added the type/bug The issue is confirmed as a bug. label Jul 28, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 labels Jul 28, 2022
@seiya-annie seiya-annie added affects-6.2 and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 labels Jul 28, 2022
ti-chi-bot pushed a commit that referenced this issue Aug 1, 2022
ti-chi-bot pushed a commit that referenced this issue Aug 1, 2022
@qw4990
Copy link
Contributor

qw4990 commented Aug 4, 2022

Do we have any document about the hint merge()?

@dayicklp
Copy link
Contributor

dayicklp commented Aug 4, 2022

Do we have any document about the hint merge()?

doc-cn is merged, and doc will be available soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.2 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants