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 (
    6018, 6185, 6114, 5647, 6146, 6187, 5651, 
    6299, 6307
  ) 
  AND f.display_on_catalog = 'Y' 
  AND (
    f.categories_path = '' 
    OR FIND_IN_SET(521, f.categories_path) 
    OR FIND_IN_SET(522, f.categories_path) 
    OR FIND_IN_SET(536, 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.00565

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "190.48"
    },
    "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": "product_id",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 310,
            "rows_produced_per_join": 100,
            "filtered": "32.51",
            "index_condition": "(`softwarepirmam_hewadelivard_cscart_4`.`v`.`product_id` in (6018,6185,6114,5647,6146,6187,5651,6299,6307))",
            "cost_info": {
              "read_cost": "131.68",
              "eval_cost": "10.08",
              "prefix_cost": "141.76",
              "data_read_per_join": "77K"
            },
            "used_columns": [
              "feature_id",
              "product_id",
              "variant_id",
              "value",
              "value_int",
              "lang_code"
            ],
            "attached_condition": "((`softwarepirmam_hewadelivard_cscart_4`.`v`.`lang_code` = 'ar') and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`feature_id` is not null))"
          }
        },
        {
          "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": "25.20",
              "eval_cost": "0.96",
              "prefix_cost": "177.04",
              "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(521,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(522,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(536,`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.40",
              "eval_cost": "0.96",
              "prefix_cost": "180.40",
              "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.40",
              "eval_cost": "0.96",
              "prefix_cost": "183.76",
              "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.40",
              "eval_cost": "0.96",
              "prefix_cost": "187.12",
              "data_read_per_join": "29K"
            },
            "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.40",
              "eval_cost": "0.96",
              "prefix_cost": "190.48",
              "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
5647 745 7416 S Camera Connectivity Wired / Network (PoE or 12 VDC) 0 0
5651 745 7416 S Camera Connectivity Wired / Network (PoE or 12 VDC) 0 0
6018 745 7738 S Camera Connectivity Wi-Fi (2.4 GHz, IEEE 802.11b/g/n) 0 0
6114 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
6146 745 7826 S Camera Connectivity Coaxial (TVI) 0 0
6185 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
6187 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
6299 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
6307 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
5647 744 7439 S Camera Type Fixed Dome Network Camera 0 0
5651 744 7439 S Camera Type Fixed Dome Network Camera 0 0
6018 744 7739 S Camera Type Indoor battery-powered fixed / palm-sized camera (with magnetic base) 0 0
6114 744 7406 S Camera Type Fixed Turret Network Camera 0 0
6146 744 7032 S Camera Type Indoor Fixed Turret Camera 0 0
6185 744 7439 S Camera Type Fixed Dome Network Camera 0 0
6187 744 7406 S Camera Type Fixed Turret Network Camera 0 0
6299 744 7406 S Camera Type Fixed Turret Network Camera 0 0
6307 744 8096 S Camera Type Varifocal Dome Network Camera 0 0
5647 735 7471 S Field of View (FOV) 2.8 mm, horizontal FOV 113°, vertical FOV 62°, diagonal FOV 134° 0 0
5651 735 7484 S Field of View (FOV) 2.8 mm, horizontal FOV 96°, vertical FOV 52°, diagonal FOV 114° 0 0
6018 735 7740 S Field of View (FOV) ~100° diagonal, ~85° horizontal, ~46° vertical 0 0
6114 735 7453 S Field of View (FOV) 2.8 mm, horizontal FOV 105°, vertical FOV 55°, diagonal FOV 127° 0 0
6146 735 7308 S Field of View (FOV) 2.8 mm, horizontal FOV: 105.0°, vertical FOV: 62.5°, diagonal FOV: 129°; 0 0
6185 735 7828 S Field of View (FOV) 2.8 mm, horizontal FOV 106°, vertical FOV 56°, diagonal FOV 129° 0 0
6187 735 7828 S Field of View (FOV) 2.8 mm, horizontal FOV 106°, vertical FOV 56°, diagonal FOV 129° 0 0
6299 735 7484 S Field of View (FOV) 2.8 mm, horizontal FOV 96°, vertical FOV 52°, diagonal FOV 114° 0 0
6307 735 7317 S Field of View (FOV) 2.8 to 12 mm, horizontal FOV 106° to 35.6°, vertical FOV 55.9° to 20°, diagonal FOV 127.4° to 40.8° 0 0
5647 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
5651 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
6018 736 7741 S Focal Length 4 mm @ f/1.6 0 0
6114 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
6146 736 7030 S Focal Length 2.8 mm / 3.6 mm 0 0
6185 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
6187 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
6299 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
6307 736 7318 S Focal Length 2.8-12 mm 0 0
5647 737 7479 S Night Mode Smart Hybrid Light (IR + white LED), supplement light up to 30 m 0 0
5651 737 7485 S Night Mode Smart Hybrid Light (IR + white LED), supplement light up to 30 m 0 0
6018 737 7742 S Night Mode IR night vision up to ~5 meters 0 0
6114 737 0.00 7802 S Night Mode Smart Hybrid Light (IR & White Light) 0 0
6146 737 7083 S Night Mode IR Night Vision up to 40 m 0 0
6185 737 0.00 7829 S Night Mode Smart Hybrid Light (IR & Warm Light) 0 0
6187 737 7829 S Night Mode Smart Hybrid Light (IR & Warm Light) 0 0
6299 737 7829 S Night Mode Smart Hybrid Light (IR & Warm Light) 0 0
6307 737 8097 S Night Mode Dual Light (IR & Warm Light) 0 0
5647 738 7480 S Operating Conditions −30°C to +60°C; housing rated IP67 (weatherproof), IK08 (vandal-resistant) 0 0
5651 738 7486 S Operating Conditions −30 °C to +60 °C; IP67 weatherproof, IK10 vandal-resistant 0 0
6018 738 7743 S Operating Conditions –10°C to 45°C, humidity up to 95% non-condensing 0 0
6114 738 -30.00 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
6146 738 7827 S Operating Conditions -40°C to 60°C, Humidity ≤ 90% (non-condensing) 0 0
6185 738 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
6187 738 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
6299 738 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
6307 738 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
5647 645 1.00 7481 S Ports 1 × microSD card slot (supports microSD/microSDHC/microSDXC up to 512 GB) 0 110
5651 645 7459 S Ports 1 × microSD card slot microSD / microSDHC / microSDXC up to 512 GB 0 110
6018 645 0.00 7745 S Ports USB Type-C port for charging/power input 0 110
6114 645 1.00 7805 S Ports 1 × RJ45 10M/100M Ethernet Port 0 110
6185 645 7805 S Ports 1 × RJ45 10M/100M Ethernet Port 0 110
6187 645 7805 S Ports 1 × RJ45 10M/100M Ethernet Port 0 110
6299 645 7805 S Ports 1 × RJ45 10M/100M Ethernet Port 0 110
6307 645 1.00 8098 S Ports 1 × RJ45 10M/100M Ethernet Port, Audio I/O, Alarm I/O 0 110
5647 642 7235 S Resolution 8 MP (3840 × 2160) 4K UHD 0 50
5651 642 7425 S Resolution 4 MP (2688 × 1520) Full HD 0 50
6018 642 7744 S Resolution Full HD 1080p (1920×1080) at up to ~15 fps, self-adaptive 0 50
6114 642 6.00 7804 S Resolution 6 MP (3072 × 2048) 0 50
6146 642 7300 S Resolution 3K (2960 × 1665) 0 50
6185 642 7017 S Resolution 2 MP (1920 × 1080) Full HD 0 50
6187 642 7017 S Resolution 2 MP (1920 × 1080) Full HD 0 50
6299 642 8088 S Resolution 4 MP (2560 × 1440) 0 50
6307 642 7411 S Resolution 6 MP (3200 × 1800) Full HD 0 50
5647 646 1.00 7482 S Sensor 1/2.7" Progressive Scan CMOS 0 130
5651 646 7427 S Sensor 1/1.8″ Progressive Scan CMOS 0 130
6018 646 1.00 7746 S Sensor 1/2.8″ 2-megapixel progressive scan CMOS 0 130
6114 646 7482 S Sensor 1/2.7" Progressive Scan CMOS 0 130
6185 646 7019 S Sensor 1/2.8" Progressive Scan CMOS 0 130
6187 646 7019 S Sensor 1/2.8" Progressive Scan CMOS 0 130
6299 646 7482 S Sensor 1/2.7" Progressive Scan CMOS 0 130
6307 646 1.00 8099 S Sensor 1/2.5" Progressive Scan CMOS 0 130
5647 648 7428 S التخزين On-board storage via microSD up to 512 GB 0 170
5651 648 7324 S التخزين On-board storage via microSD/microSDHC/microSDXC up to 512 GB 0 170
6018 648 0.00 7747 S التخزين Supports microSD cards up to 512 GB + optional EZVIZ CloudPlay storage 0 170
6114 648 0.00 7806 S التخزين Supports microSD/SDHC/SDXC card, up to 256 GB 0 170
6185 648 7806 S التخزين Supports microSD/SDHC/SDXC card, up to 256 GB 0 170
6187 648 7806 S التخزين Supports microSD/SDHC/SDXC card, up to 256 GB 0 170
6299 648 7806 S التخزين Supports microSD/SDHC/SDXC card, up to 256 GB 0 170
6307 648 7806 S التخزين Supports microSD/SDHC/SDXC card, up to 256 GB 0 170
5647 656 1559 S لون White 0 160
5651 656 1559 S لون White 0 160
6018 656 1560 S لون Black 0 160
6114 656 1559 S لون White 0 160
6185 656 1559 S لون White 0 160
6187 656 1559 S لون White 0 160
6299 656 1559 S لون White 0 160
6307 656 1559 S لون White 0 160
5647 657 6403 E ماركة Hikvision 0 0
5651 657 6403 E ماركة Hikvision 0 0
6018 657 6402 E ماركة Ezviz 0 0
6114 657 6403 E ماركة Hikvision 0 0
6146 657 6403 E ماركة Hikvision 0 0
6185 657 6403 E ماركة Hikvision 0 0
6187 657 6403 E ماركة Hikvision 0 0
6299 657 6403 E ماركة Hikvision 0 0
6307 657 6403 E ماركة Hikvision 0 0