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 (5739, 5727, 944, 478, 985, 525, 508) 
  AND f.display_on_catalog = 'Y' 
  AND (
    f.categories_path = '' 
    OR FIND_IN_SET(166, f.categories_path) 
    OR FIND_IN_SET(234, f.categories_path) 
    OR FIND_IN_SET(235, 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.00328

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "187.55"
    },
    "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": 306,
            "rows_produced_per_join": 99,
            "filtered": "32.51",
            "index_condition": "(((`softwarepirmam_hewadelivard_cscart_4`.`v`.`product_id` in (5739,5727,944,478,985,525,508)) and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`lang_code` = 'ar')) and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`feature_id` is not null))",
            "cost_info": {
              "read_cost": "129.51",
              "eval_cost": "9.95",
              "prefix_cost": "139.46",
              "data_read_per_join": "76K"
            },
            "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": 9,
            "filtered": "9.53",
            "cost_info": {
              "read_cost": "24.87",
              "eval_cost": "0.95",
              "prefix_cost": "174.28",
              "data_read_per_join": "4K"
            },
            "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(234,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(235,`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": 9,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.37",
              "eval_cost": "0.95",
              "prefix_cost": "177.60",
              "data_read_per_join": "21K"
            },
            "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": 9,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.37",
              "eval_cost": "0.95",
              "prefix_cost": "180.92",
              "data_read_per_join": "10K"
            },
            "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": 9,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.37",
              "eval_cost": "0.95",
              "prefix_cost": "184.24",
              "data_read_per_join": "28K"
            },
            "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": 9,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.37",
              "eval_cost": "0.95",
              "prefix_cost": "187.55",
              "data_read_per_join": "4K"
            },
            "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
478 654 1538 S Charging Type USB Type-C Fast Charging 0 120
508 654 1538 S Charging Type USB Type-C Fast Charging 0 120
525 654 1538 S Charging Type USB Type-C Fast Charging 0 120
944 654 1538 S Charging Type USB Type-C Fast Charging 0 120
985 654 1538 S Charging Type USB Type-C Fast Charging 0 120
5727 654 7518 S Charging Type USB-C / MagSafe / Qi-2 0 120
5739 654 7532 S Charging Type USB-C (fast charge) 0 120
478 649 1518 S Display 6.1" 0 20
508 649 1518 S Display 6.1" 0 20
525 649 1515 S Display 6.9" 0 20
944 649 1516 S Display 6.3" 0 20
985 649 1517 S Display 6.7" 0 20
5727 649 1516 S Display 6.3" 0 20
5739 649 1516 S Display 6.3" 0 20
478 647 1546 S Front Camera 12MP 0 150
508 647 1546 S Front Camera 12MP 0 150
525 647 1546 S Front Camera 12MP 0 150
944 647 1546 S Front Camera 12MP 0 150
985 647 1546 S Front Camera 12MP 0 150
5727 647 7520 S Front Camera 18 MP front (Center Stage) 0 150
5739 647 7520 S Front Camera 18 MP front (Center Stage) 0 150
478 652 1528 S GPU 5-core GPU 0 80
508 652 1529 S GPU 4-core GPU 0 80
525 652 1527 S GPU 6-core GPU 0 80
944 652 1527 S GPU 6-core GPU 0 80
985 652 1528 S GPU 5-core GPU 0 80
5727 652 7516 S GPU Apple GPU (6 cores) 0 80
5739 652 7530 S GPU Apple GPU (5 cores) 0 80
478 640 1514 S Operating System iOS18 0 10
508 640 1514 S Operating System iOS18 0 10
525 640 1514 S Operating System iOS18 0 10
944 640 1514 S Operating System iOS18 0 10
985 640 1514 S Operating System iOS18 0 10
5727 640 7510 S Operating System iOS 26 0 10
5739 640 7510 S Operating System iOS 26 0 10
478 651 1525 S Processor A18 chip 0 60
508 651 1525 S Processor A18 chip 0 60
525 651 1524 S Processor A18 Pro chip 0 60
944 651 1524 S Processor A18 Pro chip 0 60
985 651 1525 S Processor A18 chip 0 60
5727 651 7514 S Processor A19 Pro 0 60
5739 651 7529 S Processor A19 0 60
478 643 1526 S Ram 8GB 0 70
508 643 1526 S Ram 8GB 0 70
525 643 1526 S Ram 8GB 0 70
944 643 1526 S Ram 8GB 0 70
985 643 1526 S Ram 8GB 0 70
5739 643 1526 S Ram 8GB 0 70
5727 643 1587 S Ram 12GB 0 70
478 655 1545 S Rear Camera 48MP 0 140
508 655 1545 S Rear Camera 48MP 0 140
525 655 1545 S Rear Camera 48MP 0 140
944 655 1545 S Rear Camera 48MP 0 140
985 655 1545 S Rear Camera 48MP 0 140
5727 655 7519 S Rear Camera 48 MP (Main) + 48 MP (Ultra Wide) + 48 MP (Telephoto) 0 140
5739 655 7533 S Rear Camera Dual 48 MP (wide + ultra-wide) 0 140
478 650 1539 S Refresh Rate 60Hz 0 40
508 650 1539 S Refresh Rate 60Hz 0 40
525 650 1539 S Refresh Rate 60Hz 0 40
944 650 1539 S Refresh Rate 60Hz 0 40
985 650 1539 S Refresh Rate 60Hz 0 40
5727 650 7512 S Refresh Rate 120 Hz (adaptive) 0 40
5739 650 7512 S Refresh Rate 120 Hz (adaptive) 0 40
478 642 1521 S Resolution 2556-by-1179-pixel 0 50
508 642 1523 S Resolution 2532-by-1170-pixel 0 50
525 642 1519 S Resolution 2868-by-1320-pixel 0 50
944 642 1520 S Resolution 2622-by-1206-pixel 0 50
985 642 1522 S Resolution 2796-by-1290-pixel 0 50
5727 642 7513 S Resolution 2622 × 1206 px 0 50
5739 642 7513 S Resolution 2622 × 1206 px 0 50
478 644 1530 S SIM Dual eSIM 0 90
508 644 1530 S SIM Dual eSIM 0 90
525 644 1530 S SIM Dual eSIM 0 90
944 644 1530 S SIM Dual eSIM 0 90
985 644 1530 S SIM Dual eSIM 0 90
5727 644 7524 S SIM 1 × Nano-SIM + 1 × eSIM 0 90
5739 644 7524 S SIM 1 × Nano-SIM + 1 × eSIM 0 90
478 648 1561 S التخزين 128GB 0 170
508 648 1561 S التخزين 128GB 0 170
944 648 1561 S التخزين 128GB 0 170
985 648 1561 S التخزين 128GB 0 170
525 648 1562 S التخزين 256GB 0 170
5727 648 1562 S التخزين 256GB 0 170
5739 648 1562 S التخزين 256GB 0 170
478 653 1531 S باتري 3,561mAh 0 100
508 653 1535 S باتري 4,005mAh 0 100
525 653 1534 S باتري 4,685mAh 0 100
944 653 1533 S باتري 3,582mAh 0 100
985 653 1532 S باتري 4,674mAh 0 100
5727 653 7517 S باتري 4252 mAh 0 100
5739 653 7531 S باتري 3692 mAh 0 100
478 656 1556 S لون Ultramarine 0 160
508 656 1559 S لون White 0 160
5727 656 7521 S لون Cosmic Orange 0 160
5739 656 1784 S لون Lavender 0 160
525 656 1552 S لون Desert Titanium 0 160
944 656 1553 S لون Natural Titanium 0 160
985 656 1660 S لون Frost Black 0 160
478 657 1665 E ماركة Apple 0 0
508 657 1665 E ماركة Apple 0 0
525 657 1665 E ماركة Apple 0 0
944 657 1665 E ماركة Apple 0 0
985 657 1665 E ماركة Apple 0 0
5727 657 1665 E ماركة Apple 0 0
5739 657 1665 E ماركة Apple 0 0