describe SELECT DISTINCT brands name dealers city FROM brands cars abs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
describe
SELECT DISTINCT brands.name, dealers.city
FROM
brands,
cars,
abstract_users AS dealers
WHERE
cars.brand_id = brands.id
AND cars.owner_id = dealers.id
AND dealers.type = 'Dealer'
AND brands.url_path IN ('audi', 'bmw', 'vw')
AND dealers.city IN ('berlin', 'bielefeld', 'bochum', 'bonn', 'bremen', 'dortmund', 'dresden', 'dsseldorf', 'duisburg', 'freiburg', 'hamburg', 'hannover', 'kln', 'leipzig', 'mannheim', 'mnchen', 'nrnberg', 'stuttgart', 'wuppertal');
+----+-------------+---------+--------+--------------------------------------------------------------------------------+------------------------------+---------+---------------------------------+------+-----------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+--------+--------------------------------------------------------------------------------+------------------------------+---------+---------------------------------+------+-----------------------------------------------------+
| 1 | SIMPLE | dealers | range | PRIMARY,index_abstract_users_on_type,index_abstract_users_on_city | index_abstract_users_on_city | 768 | NULL | 57 | Using index condition; Using where; Using temporary |
| 1 | SIMPLE | cars | ref | cars_dealer_id_index,cars_brand_id_index,index_cars_on_owner_id_and_owner_type | cars_dealer_id_index | 5 | pkwde_development.dealers.id | 1 | Using where |
| 1 | SIMPLE | brands | eq_ref | PRIMARY,index_brands_on_url_path | PRIMARY | 4 | pkwde_development.cars.brand_id | 1 | Using where |
+----+-------------+---------+--------+--------------------------------------------------------------------------------+------------------------------+---------+---------------------------------+------+-----------------------------------------------------+