select * from city ;
select * from country;
explain format = 'json'
-- explain
select * from city c join country cy
on c.country_id = cy.country_id
where city_id between 1 and 10
;
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "5.76"
},
"nested_loop": [
{
"table": {
"table_name": "c",
"access_type": "range",
"possible_keys": [
"PRIMARY",
"idx_fk_country_id"
],
"key": "PRIMARY",
"used_key_parts": [
"city_id"
],
"key_length": "2",
"rows_examined_per_scan": 10,
"rows_produced_per_join": 10,
"filtered": "100.00",
"cost_info": {
"read_cost": "1.26",
"eval_cost": "1.00",
"prefix_cost": "2.26",
"data_read_per_join": "2K"
},
"used_columns": [
"city_id",
"city",
"country_id",
"last_update"
],
"attached_condition": "(`c`.`city_id` between 1 and 10)"
}
},
{
"table": {
"table_name": "cy",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY"
],
"key": "PRIMARY",
"used_key_parts": [
"country_id"
],
"key_length": "2",
"ref": [
"sakila.c.country_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 10,
"filtered": "100.00",
"cost_info": {
"read_cost": "2.50",
"eval_cost": "1.00",
"prefix_cost": "5.76",
"data_read_per_join": "2K"
},
"used_columns": [
"country_id",
"country",
"last_update"
]
}
}
]
}
}
'MySQL-MariaDB' 카테고리의 다른 글
MySQL 트랜잭션과 잠금 (0) | 2021.10.09 |
---|---|
MYSQL LOCK 확인및 KILL (0) | 2021.04.16 |
mysql hint (0) | 2021.02.23 |
오로라 #1 (0) | 2021.02.19 |
Aurora MySQL에서 해시 조인 작업 (0) | 2021.02.16 |