SELECT 
  cscart_product_feature_variant_descriptions.variant, 
  cscart_product_feature_variants.variant_id, 
  cscart_product_feature_variants.feature_id, 
  cscart_product_features_values.variant_id as selected, 
  cscart_product_features.feature_type, 
  cscart_seo_names.name as seo_name, 
  cscart_seo_names.path as seo_path 
FROM 
  cscart_product_feature_variants 
  LEFT JOIN cscart_product_feature_variant_descriptions ON cscart_product_feature_variant_descriptions.variant_id = cscart_product_feature_variants.variant_id 
  AND cscart_product_feature_variant_descriptions.lang_code = 'en' 
  INNER JOIN cscart_product_features_values ON cscart_product_features_values.variant_id = cscart_product_feature_variants.variant_id 
  AND cscart_product_features_values.lang_code = 'en' 
  AND cscart_product_features_values.product_id = 206983 
  AND cscart_product_features_values.feature_id = cscart_product_feature_variants.feature_id 
  LEFT JOIN cscart_product_features ON cscart_product_features.feature_id = cscart_product_feature_variants.feature_id 
  LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = cscart_product_feature_variants.variant_id 
  AND cscart_seo_names.type = 'e' 
  AND cscart_seo_names.dispatch = '' 
  AND cscart_seo_names.lang_code = 'en' 
WHERE 
  1 
  AND cscart_product_feature_variants.feature_id IN (865, 741, 835, 834, 817) 
GROUP BY 
  cscart_product_feature_variants.variant_id 
ORDER BY 
  cscart_product_feature_variants.position, 
  cscart_product_feature_variant_descriptions.variant

Query time 0.00397

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "25.10"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": false,
        "nested_loop": [
          {
            "table": {
              "table_name": "cscart_product_features_values",
              "access_type": "ref",
              "possible_keys": [
                "PRIMARY",
                "fl",
                "variant_id",
                "lang_code",
                "product_id",
                "fpl",
                "idx_product_feature_variant_id"
              ],
              "key": "idx_product_feature_variant_id",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "const"
              ],
              "rows_examined_per_scan": 118,
              "rows_produced_per_join": 0,
              "filtered": "0.04",
              "using_index": true,
              "cost_info": {
                "read_cost": "1.43",
                "eval_cost": "0.01",
                "prefix_cost": "25.03",
                "data_read_per_join": "39"
              },
              "used_columns": [
                "feature_id",
                "product_id",
                "variant_id",
                "lang_code"
              ],
              "attached_condition": "((`webmarco`.`cscart_product_features_values`.`feature_id` in (865,741,835,834,817)) and (`webmarco`.`cscart_product_features_values`.`lang_code` = 'en'))"
            }
          },
          {
            "table": {
              "table_name": "cscart_product_feature_variants",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "feature_id",
                "position"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "variant_id"
              ],
              "key_length": "3",
              "ref": [
                "webmarco.cscart_product_features_values.variant_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 0,
              "filtered": "5.00",
              "cost_info": {
                "read_cost": "0.05",
                "eval_cost": "0.00",
                "prefix_cost": "25.09",
                "data_read_per_join": "2"
              },
              "used_columns": [
                "variant_id",
                "feature_id",
                "position"
              ],
              "attached_condition": "(`webmarco`.`cscart_product_feature_variants`.`feature_id` = `webmarco`.`cscart_product_features_values`.`feature_id`)"
            }
          },
          {
            "table": {
              "table_name": "cscart_product_features",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "feature_id"
              ],
              "key_length": "3",
              "ref": [
                "webmarco.cscart_product_features_values.feature_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 0,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.00",
                "prefix_cost": "25.09",
                "data_read_per_join": "1"
              },
              "used_columns": [
                "feature_id",
                "feature_type"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_product_feature_variant_descriptions",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "variant_id",
                "lang_code"
              ],
              "key_length": "9",
              "ref": [
                "webmarco.cscart_product_features_values.variant_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 0,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.00",
                "prefix_cost": "25.09",
                "data_read_per_join": "11"
              },
              "used_columns": [
                "variant_id",
                "variant",
                "lang_code"
              ]
            }
          },
          {
            "table": {
              "table_name": "cscart_seo_names",
              "access_type": "ref",
              "possible_keys": [
                "PRIMARY",
                "dispatch"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "object_id",
                "type",
                "dispatch",
                "lang_code"
              ],
              "key_length": "206",
              "ref": [
                "webmarco.cscart_product_features_values.variant_id",
                "const",
                "const",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 0,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.00",
                "prefix_cost": "25.10",
                "data_read_per_join": "4"
              },
              "used_columns": [
                "name",
                "object_id",
                "company_id",
                "type",
                "dispatch",
                "path",
                "lang_code"
              ]
            }
          }
        ]
      }
    }
  }
}

Result

variant variant_id feature_id selected feature_type seo_name seo_path
Albania 59737 835 59737 M
Belsh 60102 865 60102 M
Berat 60103 865 60103 M
Bulqize 60104 865 60104 M
Cerrik 60105 865 60105 M
Delvine 60106 865 60106 M
Devoll 60107 865 60107 M
Diber 60108 865 60108 M
Divjake 60109 865 60109 M
Dropull 60110 865 60110 M
Durres 60111 865 60111 M
Elbasan 60112 865 60112 M
Fier 60113 865 60113 M
Finiq 60114 865 60114 M
Fushe-Arrez 60115 865 60115 M
Gjirokaster 60116 865 60116 M
Gramsh 60117 865 60117 M
Has 60118 865 60118 M
Himare 60119 865 60119 M
Kamez 60120 865 60120 M
Kavaje 60121 865 60121 M
Kelcyre 60122 865 60122 M
Klos 60123 865 60123 M
Kolonje 60124 865 60124 M
Konispol 60125 865 60125 M
Korca 61624 817 61624 M
Korca 61621 834 61621 M
Korce 60126 865 60126 M
Kruje 60127 865 60127 M
Kucove 60128 865 60128 M
Kukes 60129 865 60129 M
Kurbin 60130 865 60130 M
Lezhe 60131 865 60131 M
Libohove 60132 865 60132 M
Librazhd 60133 865 60133 M
Lushnje 60134 865 60134 M
Malesi e Madhe 60135 865 60135 M
Maliq 60136 865 60136 M
Mallakaster 60137 865 60137 M
Mat 60138 865 60138 M
Memaliaj 60139 865 60139 M
Mirdite 60140 865 60140 M
Patos 60141 865 60141 M
Peqin 60142 865 60142 M
Permet 60143 865 60143 M
Perrenjas 60146 865 60146 M
Photography and Videography Services 61623 741 61623 M
Pogradec 60144 865 60144 M
Polican 60145 865 60145 M
Puke 60147 865 60147 M
Pustec 60148 865 60148 M
Roskovec 60149 865 60149 M
Rrogozhine 60150 865 60150 M
Sarande 60151 865 60151 M
Selenice 60152 865 60152 M
Shijak 60153 865 60153 M
Shkoder 60154 865 60154 M
Skrapar 60155 865 60155 M
Tepelene 60156 865 60156 M
Tirane 60157 865 60157 M
Tropoje 60158 865 60158 M
Ura Vajgurore 60159 865 60159 M
Vau i Dejes 60160 865 60160 M
Vlore 60161 865 60161 M
Vore 60162 865 60162 M