[Solved] SQL INNER JOIN over multiple tables equal to WHERE syntax

How to optimize this SQL query?

In case you have your own slow SQL query, you can optimize it automatically here.

For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:

  1. Description of the steps you can take to speed up the query.
  2. The optimal indexes for this query, which you can copy and create in your database.
  3. An automatically re-written query you can copy and execute in your database.
The optimization process and recommendations:
  1. Create Optimal Indexes (modified query below): The recommended indexes are an integral part of this optimization effort and should be created before testing the execution duration of the optimized query.
Optimal indexes for this query:
ALTER TABLE `genre_mapping_table` ADD INDEX `genre_table_idx_s_id_g_id` (`s_id`,`g_id`);
ALTER TABLE `genre_name_table` ADD INDEX `genre_table_idx_g_id_t_id` (`g_id`,`t_id`);
ALTER TABLE `genre_name_translation_table` ADD INDEX `genre_translation_idx_id_code_id` (`id`,`code_id`);
ALTER TABLE `genre_table` ADD INDEX `genre_table_idx_id` (`id`);
ALTER TABLE `language_code_table` ADD INDEX `language_table_idx_language_code_id` (`language_iso_code`,`id`);
ALTER TABLE `service_iradio_table` ADD INDEX `service_table_idx_name_id` (`name`,`id`);
The optimized query:
        service_iradio_table AS iradio,
        genre_table AS genre,
        genre_name_table AS genre_name,
        genre_name_translation_table AS genre_trans,
        genre_mapping_table AS genre_mapping,
        language_code_table AS code 
        iradio.id = genre_mapping.s_id 
        AND genre_mapping.g_id = genre.id 
        AND genre.id = genre_name.g_id 
        AND genre_name.t_id = genre_trans.id 
        AND genre_trans.code_id = code.id 
        AND iradio.name = 'MyRadio' 
        AND code.language_iso_code = 'ger'

Related Articles

* original question posted on StackOverflow here.