Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mysql-test/main/delete_use_source.result
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 8 100.00 Using where
1 PRIMARY t2 ref a a 5 test.t2.c1 1 100.00 Using index; FirstMatch(t2)
Warnings:
Note 1003 delete from `test`.`t1` `t2` using (`test`.`t2`) where `test`.`t2`.`a` = `test`.`t2`.`c1`
Note 1003 delete from `t2` using (`test`.`t2`) where `test`.`t2`.`a` = `test`.`t2`.`c1`
delete from t1 t2 where t2.c1 in (select a from t2);
select * from t1;
c1 c2 c3
Expand All @@ -368,7 +368,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t_x ALL NULL NULL NULL NULL 7 100.00 Using where
1 PRIMARY t_y ref a a 5 test.t_x.c2 1 100.00 Using index; FirstMatch(t_x)
Warnings:
Note 1003 delete from `test`.`t1` `t_x` using (`test`.`t2` `t_y`) where `test`.`t_y`.`a` = `test`.`t_x`.`c2`
Note 1003 delete from `t_x` using (`test`.`t2` `t_y`) where `test`.`t_y`.`a` = `test`.`t_x`.`c2`
delete from t1 t_x where t_x.c2 IN (select a from t2 as t_y);
select * from t1;
c1 c2 c3
Expand All @@ -383,7 +383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t_x ALL NULL NULL NULL NULL 4 100.00 Using where
1 PRIMARY t_x ref a a 5 test.t_x.c3 1 100.00 Using index; FirstMatch(t_x)
Warnings:
Note 1003 delete from `test`.`t1` `t_x` using (`test`.`t2` `t_x`) where `test`.`t_x`.`a` = `test`.`t_x`.`c3`
Note 1003 delete from `t_x` using (`test`.`t2` `t_x`) where `test`.`t_x`.`a` = `test`.`t_x`.`c3`
delete from t1 as t_x where t_x.c3 IN (select a from t2 t_x);
select * from t1;
c1 c2 c3
Expand All @@ -397,7 +397,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t1 index NULL a 5 NULL 3 33.33 Using where; Using index; FirstMatch(t2)
Warnings:
Note 1003 delete from `test`.`t1` `t2` using (`test`.`t2` `t1`) where `test`.`t2`.`c1` = `test`.`t1`.`a` - 1
Note 1003 delete from `t2` using (`test`.`t2` `t1`) where `test`.`t2`.`c1` = `test`.`t1`.`a` - 1
delete from t1 t2 where t2.c1 IN (select a -1 from t2 as t1);
select * from t1;
c1 c2 c3
Expand Down
12 changes: 6 additions & 6 deletions mysql-test/main/opt_hints_join_order.result
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta1 eq_ref PRIMARY PRIMARY 4 test.t2.f1 1 100.00 Using where
1 PRIMARY ta2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 delete from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
Note 1003 delete from `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
# Applicable hint
EXPLAIN EXTENDED DELETE /*+ JOIN_PREFIX(t2, t3, ta2) */
FROM ta1.* USING t1 AS ta1 JOIN t1 AS ta2 ON 1
Expand All @@ -906,7 +906,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta1 eq_ref PRIMARY PRIMARY 4 test.t2.f1 1 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 3 33.33 Using where
Warnings:
Note 1003 delete /*+ JOIN_PREFIX(@`select#1` `t2`,`t3`,`ta2`) */ from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
Note 1003 delete /*+ JOIN_PREFIX(@`select#1` `t2`,`t3`,`ta2`) */ from `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
# Applicable hint
EXPLAIN EXTENDED DELETE /*+ JOIN_PREFIX(t2, t3, ta1, ta2) */
FROM ta1.* USING t1 AS ta1 JOIN t1 AS ta2 ON 1
Expand All @@ -919,7 +919,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta2 ALL NULL NULL NULL NULL 3 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 3 33.33 Using where
Warnings:
Note 1003 delete /*+ JOIN_PREFIX(@`select#1` `t2`,`t3`,`ta1`,`ta2`) */ from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
Note 1003 delete /*+ JOIN_PREFIX(@`select#1` `t2`,`t3`,`ta1`,`ta2`) */ from `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
# Applicable hint
EXPLAIN EXTENDED DELETE /*+ JOIN_PREFIX(t2, t3, ta2, ta1) */
FROM ta1.* USING t1 AS ta1 JOIN t1 AS ta2 ON 1
Expand All @@ -932,7 +932,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta1 eq_ref PRIMARY PRIMARY 4 test.t2.f1 1 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 3 33.33 Using where
Warnings:
Note 1003 delete /*+ JOIN_PREFIX(@`select#1` `t2`,`t3`,`ta2`,`ta1`) */ from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
Note 1003 delete /*+ JOIN_PREFIX(@`select#1` `t2`,`t3`,`ta2`,`ta1`) */ from `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
# Hint should be ignored
EXPLAIN EXTENDED DELETE /*+ JOIN_SUFFIX(ta2, t3, ta1) */
FROM ta1.* USING t1 AS ta1 JOIN t1 AS ta2 ON 1
Expand All @@ -945,7 +945,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY ta2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Warning 4219 Hint JOIN_SUFFIX(`ta2`,`t3`,`ta1`) is ignored as conflicting/duplicated
Note 1003 delete from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
Note 1003 delete from `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
# Both hints are ignored
EXPLAIN EXTENDED DELETE /*+ JOIN_PREFIX(ta1, t2, t3) JOIN_SUFFIX(t3, ta2) */
FROM ta1.* USING t1 AS ta1 JOIN t1 AS ta2 ON 1
Expand All @@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Warning 4219 Hint JOIN_PREFIX(`ta1`,`t2`,`t3`) is ignored as conflicting/duplicated
Warning 4219 Hint JOIN_SUFFIX(`t3`,`ta2`) is ignored as conflicting/duplicated
Note 1003 delete from `test`.`t1` `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
Note 1003 delete from `ta1` using `test`.`t2` semi join (`test`.`t3`) left join (`test`.`t1` `ta1` join `test`.`t1` `ta2`) on(`test`.`ta1`.`f1` = `test`.`t2`.`f1` and 1 and `test`.`t2`.`f1` is not null) where `test`.`t3`.`f1` = 9
DROP TABLE t1, t2, t3;
# Const table behavior, table order is not changed, hint is applicable.
# Note: Const tables are excluded from the process of dependency setting
Expand Down
96 changes: 9 additions & 87 deletions mysql-test/suite/federated/federatedx_create_handlers.result
Original file line number Diff line number Diff line change
Expand Up @@ -1401,43 +1401,9 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 1000.010933,
"nested_loop": [
{
"table": {
"table_name": "p",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": 1000.010388,
"filtered": 100,
"attached_condition": "p.product_id is not null"
}
},
{
"table": {
"table_name": "<derived2>",
"access_type": "ref",
"possible_keys": ["key0"],
"key": "key0",
"key_length": "9",
"used_key_parts": ["product_id"],
"ref": ["federated.p.product_id"],
"loops": 2,
"rows": 1,
"cost": 0.000545388,
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 2,
"table": {
"message": "Pushed derived"
}
}
}
}
}
]
"table": {
"message": "Pushed update"
}
}
}
update
Expand Down Expand Up @@ -1480,31 +1446,9 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 2000.022975,
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"rows": 4,
"cost": 1000.010655,
"filtered": 100,
"attached_condition": "t2.`id` in (1,2)"
}
},
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 4,
"rows": 4,
"cost": 1000.012319,
"filtered": 100,
"attached_condition": "t1.`id` = t2.`id`"
}
}
]
"table": {
"message": "Pushed update"
}
}
}
update federated.t2 inner join federated.t1 on t2.id = t1.id
Expand Down Expand Up @@ -1534,31 +1478,9 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 2000.023025,
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"rows": 4,
"cost": 1000.010705,
"filtered": 100,
"attached_condition": "t2.op = 'updated'"
}
},
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 4,
"rows": 4,
"cost": 1000.012319,
"filtered": 100,
"attached_condition": "t1.`id` = t2.`id`"
}
}
]
"table": {
"message": "Pushed delete"
}
}
}
delete federated.t2 from federated.t2 inner join federated.t1 on t2.id = t1.id and t2.op = 'updated';
Expand Down
Loading