SELECT 
  v.product_id, 
  v.feature_id, 
  v.value, 
  v.value_int, 
  v.variant_id, 
  f.feature_type, 
  fd.description, 
  fd.prefix, 
  fd.suffix, 
  vd.variant, 
  f.parent_id, 
  f.position, 
  gf.position as gposition 
FROM 
  cscart_product_features as f 
  LEFT JOIN cscart_product_features_values as v ON v.feature_id = f.feature_id 
  LEFT JOIN cscart_product_features_descriptions as fd ON fd.feature_id = v.feature_id 
  AND fd.lang_code = 'ar' 
  LEFT JOIN cscart_product_feature_variants fv ON fv.variant_id = v.variant_id 
  LEFT JOIN cscart_product_feature_variant_descriptions as vd ON vd.variant_id = fv.variant_id 
  AND vd.lang_code = 'ar' 
  LEFT JOIN cscart_product_features as gf ON gf.feature_id = f.parent_id 
  AND gf.feature_type = 'G' 
WHERE 
  f.status IN ('A') 
  AND v.product_id in (
    3660, 3740, 3743, 3741, 3441, 3768, 3747, 
    3738, 3443, 3737, 3655, 3658, 3769, 
    3745, 3767, 3659, 3766, 3739, 3444, 
    3785, 3442, 3787, 3770, 3447, 3793, 
    3450, 3772, 3795, 3788, 3439, 3446, 
    3794, 3449, 3871, 3786, 3867, 3881
  ) 
  AND f.display_on_catalog = 'Y' 
  AND (
    f.categories_path = '' 
    OR FIND_IN_SET(166, f.categories_path) 
    OR FIND_IN_SET(423, f.categories_path) 
    OR FIND_IN_SET(448, f.categories_path)
  ) 
  AND IF(
    f.parent_id, 
    (
      SELECT 
        status 
      FROM 
        cscart_product_features as df 
      WHERE 
        df.feature_id = f.parent_id
    ), 
    'A'
  ) IN ('A') 
  AND (
    v.variant_id != 0 
    OR (
      f.feature_type != 'C' 
      AND v.value != ''
    ) 
    OR (f.feature_type = 'C') 
    OR v.value_int != ''
  ) 
  AND v.lang_code = 'ar' 
ORDER BY 
  fd.description, 
  fv.position

Query time 0.00752

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "381.45"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "v",
            "access_type": "range",
            "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",
            "rows_examined_per_scan": 613,
            "rows_produced_per_join": 199,
            "filtered": "32.51",
            "index_condition": "(((`softwarepirmam_hewadelivard_cscart_4`.`v`.`product_id` in (3660,3740,3743,3741,3441,3768,3747,3738,3443,3737,3655,3658,3769,3745,3767,3659,3766,3739,3444,3785,3442,3787,3770,3447,3793,3450,3772,3795,3788,3439,3446,3794,3449,3871,3786,3867,3881)) and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`lang_code` = 'ar')) and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`feature_id` is not null))",
            "cost_info": {
              "read_cost": "265.18",
              "eval_cost": "19.93",
              "prefix_cost": "285.11",
              "data_read_per_join": "154K"
            },
            "used_columns": [
              "feature_id",
              "product_id",
              "variant_id",
              "value",
              "value_int",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "f",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "status"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "feature_id"
            ],
            "key_length": "3",
            "ref": [
              "softwarepirmam_hewadelivard_cscart_4.v.feature_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 18,
            "filtered": "9.53",
            "cost_info": {
              "read_cost": "49.83",
              "eval_cost": "1.90",
              "prefix_cost": "354.87",
              "data_read_per_join": "8K"
            },
            "used_columns": [
              "feature_id",
              "feature_type",
              "categories_path",
              "parent_id",
              "display_on_catalog",
              "status",
              "position"
            ],
            "attached_condition": "((`softwarepirmam_hewadelivard_cscart_4`.`f`.`status` = 'A') and (`softwarepirmam_hewadelivard_cscart_4`.`f`.`display_on_catalog` = 'Y') and ((`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path` = '') or (0 <> find_in_set(166,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(423,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(448,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`))) and (if(`softwarepirmam_hewadelivard_cscart_4`.`f`.`parent_id`,(/* select#2 */ select `softwarepirmam_hewadelivard_cscart_4`.`df`.`status` from `softwarepirmam_hewadelivard_cscart_4`.`cscart_product_features` `df` where (`softwarepirmam_hewadelivard_cscart_4`.`df`.`feature_id` = `softwarepirmam_hewadelivard_cscart_4`.`f`.`parent_id`)),'A') = 'A') and ((`softwarepirmam_hewadelivard_cscart_4`.`v`.`variant_id` <> 0) or ((`softwarepirmam_hewadelivard_cscart_4`.`f`.`feature_type` <> 'C') and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`value` <> '')) or (`softwarepirmam_hewadelivard_cscart_4`.`f`.`feature_type` = 'C') or (`softwarepirmam_hewadelivard_cscart_4`.`v`.`value_int` <> 0)))",
            "attached_subqueries": [
              {
                "dependent": true,
                "cacheable": false,
                "query_block": {
                  "select_id": 2,
                  "cost_info": {
                    "query_cost": "0.35"
                  },
                  "table": {
                    "table_name": "df",
                    "access_type": "eq_ref",
                    "possible_keys": [
                      "PRIMARY"
                    ],
                    "key": "PRIMARY",
                    "used_key_parts": [
                      "feature_id"
                    ],
                    "key_length": "3",
                    "ref": [
                      "softwarepirmam_hewadelivard_cscart_4.f.parent_id"
                    ],
                    "rows_examined_per_scan": 1,
                    "rows_produced_per_join": 1,
                    "filtered": "100.00",
                    "cost_info": {
                      "read_cost": "0.25",
                      "eval_cost": "0.10",
                      "prefix_cost": "0.35",
                      "data_read_per_join": "440"
                    },
                    "used_columns": [
                      "feature_id",
                      "status"
                    ]
                  }
                }
              }
            ]
          }
        },
        {
          "table": {
            "table_name": "fd",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "feature_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "softwarepirmam_hewadelivard_cscart_4.v.feature_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 18,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "4.75",
              "eval_cost": "1.90",
              "prefix_cost": "361.52",
              "data_read_per_join": "43K"
            },
            "used_columns": [
              "feature_id",
              "description",
              "prefix",
              "suffix",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "fv",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "variant_id"
            ],
            "key_length": "3",
            "ref": [
              "softwarepirmam_hewadelivard_cscart_4.v.variant_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 18,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "4.75",
              "eval_cost": "1.90",
              "prefix_cost": "368.16",
              "data_read_per_join": "21K"
            },
            "used_columns": [
              "variant_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "vd",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "variant_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "softwarepirmam_hewadelivard_cscart_4.fv.variant_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 18,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "4.75",
              "eval_cost": "1.90",
              "prefix_cost": "374.81",
              "data_read_per_join": "57K"
            },
            "used_columns": [
              "variant_id",
              "variant",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "gf",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "feature_id"
            ],
            "key_length": "3",
            "ref": [
              "softwarepirmam_hewadelivard_cscart_4.f.parent_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 18,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "4.75",
              "eval_cost": "1.90",
              "prefix_cost": "381.46",
              "data_read_per_join": "8K"
            },
            "used_columns": [
              "feature_id",
              "feature_type",
              "position"
            ],
            "attached_condition": "<if>(is_not_null_compl(gf), (`softwarepirmam_hewadelivard_cscart_4`.`gf`.`feature_type` = 'G'), true)"
          }
        }
      ]
    }
  }
}

Result

product_id feature_id value value_int variant_id feature_type description prefix suffix variant parent_id position gposition
3439 718 3978 S Edge Coverage Full Coverage 0 0
3441 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3442 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3443 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3444 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3446 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3447 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3449 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3450 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3655 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3658 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3659 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3660 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3737 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3738 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3739 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3740 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3741 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3743 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3745 718 3979 S Edge Coverage Case Friendly 0 0
3747 718 3979 S Edge Coverage Case Friendly 0 0
3766 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3767 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3768 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3769 718 3978 S Edge Coverage Full Coverage 0 0
3770 718 3979 S Edge Coverage Case Friendly 0 0
3772 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3785 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3786 718 3979 S Edge Coverage Case Friendly 0 0
3787 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3788 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3793 718 3979 S Edge Coverage Case Friendly 0 0
3794 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3795 718 3983 S Edge Coverage Full Coverage (Edge to Edge) 0 0
3867 718 3979 S Edge Coverage Case Friendly 0 0
3871 718 3979 S Edge Coverage Case Friendly 0 0
3881 718 3979 S Edge Coverage Case Friendly 0 0
3439 719 3982 S Finish Clear 0 0
3441 719 3982 S Finish Clear 0 0
3442 719 3982 S Finish Clear 0 0
3443 719 3982 S Finish Clear 0 0
3444 719 3982 S Finish Clear 0 0
3446 719 3982 S Finish Clear 0 0
3447 719 3982 S Finish Clear 0 0
3449 719 3982 S Finish Clear 0 0
3450 719 3982 S Finish Clear 0 0
3655 719 3982 S Finish Clear 0 0
3658 719 3982 S Finish Clear 0 0
3659 719 3982 S Finish Clear 0 0
3660 719 3982 S Finish Clear 0 0
3737 719 3982 S Finish Clear 0 0
3738 719 3982 S Finish Clear 0 0
3739 719 3982 S Finish Clear 0 0
3740 719 3982 S Finish Clear 0 0
3741 719 3982 S Finish Clear 0 0
3743 719 3982 S Finish Clear 0 0
3745 719 3982 S Finish Clear 0 0
3747 719 3982 S Finish Clear 0 0
3766 719 3982 S Finish Clear 0 0
3767 719 3982 S Finish Clear 0 0
3768 719 3982 S Finish Clear 0 0
3769 719 3982 S Finish Clear 0 0
3770 719 3982 S Finish Clear 0 0
3772 719 3982 S Finish Clear 0 0
3785 719 3982 S Finish Clear 0 0
3786 719 3982 S Finish Clear 0 0
3787 719 3982 S Finish Clear 0 0
3788 719 3982 S Finish Clear 0 0
3793 719 3982 S Finish Clear 0 0
3794 719 3982 S Finish Clear 0 0
3795 719 3982 S Finish Clear 0 0
3867 719 3982 S Finish Clear 0 0
3871 719 3982 S Finish Clear 0 0
3881 719 3982 S Finish Clear 0 0
3439 717 3977 S Privacy Option No 0 0
3441 717 3977 S Privacy Option No 0 0
3442 717 3976 S Privacy Option Yes 0 0
3443 717 3977 S Privacy Option No 0 0
3444 717 3976 S Privacy Option Yes 0 0
3446 717 3976 S Privacy Option Yes 0 0
3447 717 3976 S Privacy Option Yes 0 0
3449 717 3977 S Privacy Option No 0 0
3450 717 3977 S Privacy Option No 0 0
3655 717 3976 S Privacy Option Yes 0 0
3658 717 3976 S Privacy Option Yes 0 0
3659 717 3977 S Privacy Option No 0 0
3660 717 3977 S Privacy Option No 0 0
3737 717 3977 S Privacy Option No 0 0
3738 717 3977 S Privacy Option No 0 0
3739 717 3976 S Privacy Option Yes 0 0
3740 717 3976 S Privacy Option Yes 0 0
3741 717 3977 S Privacy Option No 0 0
3743 717 3977 S Privacy Option No 0 0
3745 717 3977 S Privacy Option No 0 0
3747 717 3977 S Privacy Option No 0 0
3766 717 3976 S Privacy Option Yes 0 0
3767 717 3976 S Privacy Option Yes 0 0
3768 717 3977 S Privacy Option No 0 0
3769 717 3977 S Privacy Option No 0 0
3770 717 3977 S Privacy Option No 0 0
3772 717 3977 S Privacy Option No 0 0
3785 717 3976 S Privacy Option Yes 0 0
3786 717 3977 S Privacy Option No 0 0
3787 717 3977 S Privacy Option No 0 0
3788 717 3976 S Privacy Option Yes 0 0
3793 717 3977 S Privacy Option No 0 0
3794 717 3977 S Privacy Option No 0 0
3795 717 3976 S Privacy Option Yes 0 0
3867 717 3977 S Privacy Option No 0 0
3871 717 3976 S Privacy Option Yes 0 0
3881 717 3976 S Privacy Option Yes 0 0
3439 716 3975 S Protection Type Tempered Glass 0 0
3441 716 3975 S Protection Type Tempered Glass 0 0
3442 716 3975 S Protection Type Tempered Glass 0 0
3443 716 3975 S Protection Type Tempered Glass 0 0
3444 716 3975 S Protection Type Tempered Glass 0 0
3446 716 3975 S Protection Type Tempered Glass 0 0
3447 716 3975 S Protection Type Tempered Glass 0 0
3449 716 3975 S Protection Type Tempered Glass 0 0
3450 716 3975 S Protection Type Tempered Glass 0 0
3655 716 3975 S Protection Type Tempered Glass 0 0
3658 716 3975 S Protection Type Tempered Glass 0 0
3659 716 3975 S Protection Type Tempered Glass 0 0
3660 716 3975 S Protection Type Tempered Glass 0 0
3737 716 3975 S Protection Type Tempered Glass 0 0
3738 716 3975 S Protection Type Tempered Glass 0 0
3739 716 3975 S Protection Type Tempered Glass 0 0
3740 716 3975 S Protection Type Tempered Glass 0 0
3741 716 3975 S Protection Type Tempered Glass 0 0
3743 716 3975 S Protection Type Tempered Glass 0 0
3745 716 3975 S Protection Type Tempered Glass 0 0
3747 716 3975 S Protection Type Tempered Glass 0 0
3766 716 3975 S Protection Type Tempered Glass 0 0
3767 716 3975 S Protection Type Tempered Glass 0 0
3768 716 3975 S Protection Type Tempered Glass 0 0
3769 716 3975 S Protection Type Tempered Glass 0 0
3770 716 3975 S Protection Type Tempered Glass 0 0
3772 716 3975 S Protection Type Tempered Glass 0 0
3785 716 3975 S Protection Type Tempered Glass 0 0
3786 716 3975 S Protection Type Tempered Glass 0 0
3787 716 3975 S Protection Type Tempered Glass 0 0
3788 716 3975 S Protection Type Tempered Glass 0 0
3793 716 3975 S Protection Type Tempered Glass 0 0
3794 716 3975 S Protection Type Tempered Glass 0 0
3795 716 3975 S Protection Type Tempered Glass 0 0
3867 716 3975 S Protection Type Tempered Glass 0 0
3871 716 3975 S Protection Type Tempered Glass 0 0
3881 716 3975 S Protection Type Tempered Glass 0 0
3439 656 3985 S لون Transparent 0 160
3441 656 3985 S لون Transparent 0 160
3442 656 1560 S لون Black 0 160
3443 656 3985 S لون Transparent 0 160
3444 656 1560 S لون Black 0 160
3446 656 1560 S لون Black 0 160
3447 656 1560 S لون Black 0 160
3449 656 3985 S لون Transparent 0 160
3450 656 3985 S لون Transparent 0 160
3655 656 1560 S لون Black 0 160
3658 656 1560 S لون Black 0 160
3659 656 3985 S لون Transparent 0 160
3660 656 3985 S لون Transparent 0 160
3737 656 3985 S لون Transparent 0 160
3738 656 3985 S لون Transparent 0 160
3739 656 1560 S لون Black 0 160
3740 656 1560 S لون Black 0 160
3741 656 3985 S لون Transparent 0 160
3743 656 3985 S لون Transparent 0 160
3745 656 3985 S لون Transparent 0 160
3747 656 3985 S لون Transparent 0 160
3766 656 1560 S لون Black 0 160
3767 656 1560 S لون Black 0 160
3768 656 3985 S لون Transparent 0 160
3769 656 3985 S لون Transparent 0 160
3770 656 3985 S لون Transparent 0 160
3772 656 3985 S لون Transparent 0 160
3785 656 1560 S لون Black 0 160
3786 656 3985 S لون Transparent 0 160
3787 656 3985 S لون Transparent 0 160
3788 656 1560 S لون Black 0 160
3793 656 3985 S لون Transparent 0 160
3794 656 3985 S لون Transparent 0 160
3795 656 1560 S لون Black 0 160
3867 656 3985 S لون Transparent 0 160
3871 656 1560 S لون Black 0 160
3881 656 1560 S لون Black 0 160
3439 657 3961 E ماركة Baykron 0 0
3441 657 3961 E ماركة Baykron 0 0
3442 657 3961 E ماركة Baykron 0 0
3443 657 3961 E ماركة Baykron 0 0
3444 657 3961 E ماركة Baykron 0 0
3446 657 3961 E ماركة Baykron 0 0
3447 657 3961 E ماركة Baykron 0 0
3449 657 3961 E ماركة Baykron 0 0
3450 657 3961 E ماركة Baykron 0 0
3655 657 3961 E ماركة Baykron 0 0
3658 657 3961 E ماركة Baykron 0 0
3659 657 3961 E ماركة Baykron 0 0
3660 657 3961 E ماركة Baykron 0 0
3737 657 3961 E ماركة Baykron 0 0
3738 657 3961 E ماركة Baykron 0 0
3739 657 3961 E ماركة Baykron 0 0
3740 657 3961 E ماركة Baykron 0 0
3741 657 3961 E ماركة Baykron 0 0
3743 657 3961 E ماركة Baykron 0 0
3745 657 3961 E ماركة Baykron 0 0
3747 657 3961 E ماركة Baykron 0 0
3766 657 3961 E ماركة Baykron 0 0
3767 657 3961 E ماركة Baykron 0 0
3768 657 3961 E ماركة Baykron 0 0
3769 657 3961 E ماركة Baykron 0 0
3770 657 3961 E ماركة Baykron 0 0
3772 657 3961 E ماركة Baykron 0 0
3785 657 3961 E ماركة Baykron 0 0
3786 657 3961 E ماركة Baykron 0 0
3787 657 3961 E ماركة Baykron 0 0
3788 657 3961 E ماركة Baykron 0 0
3793 657 3961 E ماركة Baykron 0 0
3794 657 3961 E ماركة Baykron 0 0
3795 657 3961 E ماركة Baykron 0 0
3867 657 3961 E ماركة Baykron 0 0
3871 657 3961 E ماركة Baykron 0 0
3881 657 3961 E ماركة Baykron 0 0