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 = 'en' 
  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 = 'en' 
  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 (
    5502, 5333, 5594, 5363, 6185, 6114, 5647, 
    6146
  ) 
  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 = 'en' 
ORDER BY 
  fd.description, 
  fv.position

Query time 0.00376

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "168.37"
    },
    "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": 274,
            "rows_produced_per_join": 89,
            "filtered": "32.52",
            "index_condition": "(`softwarepirmam_hewadelivard_cscart_4`.`v`.`product_id` in (5502,5333,5594,5363,6185,6114,5647,6146))",
            "cost_info": {
              "read_cost": "116.40",
              "eval_cost": "8.91",
              "prefix_cost": "125.31",
              "data_read_per_join": "68K"
            },
            "used_columns": [
              "feature_id",
              "product_id",
              "variant_id",
              "value",
              "value_int",
              "lang_code"
            ],
            "attached_condition": "((`softwarepirmam_hewadelivard_cscart_4`.`v`.`lang_code` = 'en') 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": 8,
            "filtered": "9.53",
            "cost_info": {
              "read_cost": "22.27",
              "eval_cost": "0.85",
              "prefix_cost": "156.49",
              "data_read_per_join": "3K"
            },
            "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.12",
              "eval_cost": "0.85",
              "prefix_cost": "159.46",
              "data_read_per_join": "19K"
            },
            "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.12",
              "eval_cost": "0.85",
              "prefix_cost": "162.43",
              "data_read_per_join": "9K"
            },
            "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.12",
              "eval_cost": "0.85",
              "prefix_cost": "165.40",
              "data_read_per_join": "25K"
            },
            "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.12",
              "eval_cost": "0.85",
              "prefix_cost": "168.38",
              "data_read_per_join": "3K"
            },
            "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
5594 657 6403 E Brand Hikvision 0 0
6114 657 6403 E Brand Hikvision 0 0
5502 657 6403 E Brand Hikvision 0 0
6146 657 6403 E Brand Hikvision 0 0
5363 657 6403 E Brand Hikvision 0 0
5647 657 6403 E Brand Hikvision 0 0
5333 657 6403 E Brand Hikvision 0 0
6185 657 6403 E Brand Hikvision 0 0
5594 745 7315 S Camera Connectivity Wired / Ethernet (RJ-45), PoE (IEEE802.3af) 0 0
6185 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
5502 745 7304 S Camera Connectivity Wired / Analog HD (TVI) output 0 0
5333 745 7031 S Camera Connectivity Wired / Analog 4-in-1 (TVI / AHD / CVI / CVBS) 0 0
5647 745 7416 S Camera Connectivity Wired / Network (PoE or 12 VDC) 0 0
6114 745 7430 S Camera Connectivity Network (PoE or 12 VDC) 0 0
5363 745 7031 S Camera Connectivity Wired / Analog 4-in-1 (TVI / AHD / CVI / CVBS) 0 0
6146 745 7826 S Camera Connectivity Coaxial (TVI) 0 0
5594 744 7406 S Camera Type Fixed Turret Network Camera 0 0
5502 744 7305 S Camera Type Fixed PT Turret Camera 0 0
5363 744 7032 S Camera Type Indoor Fixed Turret Camera 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
5647 744 7439 S Camera Type Fixed Dome Network Camera 0 0
5333 744 7032 S Camera Type Indoor Fixed Turret Camera 0 0
6185 744 7439 S Camera Type Fixed Dome Network Camera 0 0
5502 656 1559 S Color white 0 160
5647 656 1559 S Color white 0 160
6114 656 1559 S Color white 0 160
5594 656 1559 S Color white 0 160
5363 656 1559 S Color white 0 160
5333 656 1559 S Color white 0 160
6185 656 1559 S Color white 0 160
5502 735 7297 S Field of View (FOV) 2.8 mm, horizontal FOV: 105°, vertical FOV: 62°, diagonal FOV: 131°; 0 0
6114 735 7453 S Field of View (FOV) 2.8 mm, horizontal FOV 105°, vertical FOV 55°, diagonal FOV 127° 0 0
5363 735 7037 S Field of View (FOV) 2.8 mm, horizontal FOV: 96.5°, vertical FOV: 48.9°, diagonal FOV: 120.5° 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
5594 735 7407 S Field of View (FOV) 2.8 mm, horizontal FOV 115°, vertical FOV 60°, diagonal FOV 143° 0 0
5647 735 7471 S Field of View (FOV) 2.8 mm, horizontal FOV 113°, vertical FOV 62°, diagonal FOV 134° 0 0
5333 735 7021 S Field of View (FOV) 2.8 mm, horizontal FOV: 101°, vertical FOV: 60°, diagonal FOV: 122° 0 0
6114 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
5647 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
5333 736 7030 S Focal Length 2.8 mm / 3.6 mm 0 0
5594 736 7408 S Focal Length 2.8 mm / 4 mm 0 0
5363 736 7030 S Focal Length 2.8 mm / 3.6 mm 0 0
5502 736 7030 S Focal Length 2.8 mm / 3.6 mm 0 0
5502 737 7306 S Night Mode IR up to 25 m; White Light up to 20 m with Smart-Hybrid Light 0 0
6146 737 7083 S Night Mode IR Night Vision up to 40 m 0 0
5333 737 7033 S Night Mode Smart IR up to 20 m 0 0
6185 737 0.00 7829 S Night Mode Smart Hybrid Light (IR & Warm Light) 0 0
5594 737 7409 S Night Mode Smart Hybrid Light (IR + white LED) up to 30 meters 0 0
5363 737 7078 S Night Mode EXIR up to 20 m 0 0
6114 737 0.00 7802 S Night Mode Smart Hybrid Light (IR & White Light) 0 0
5647 737 7479 S Night Mode Smart Hybrid Light (IR + white LED), supplement light up to 30 m 0 0
5333 738 7034 S Operating Conditions -40 °C to +60 °C, humidity up to 90% non-condensing 0 0
6114 738 -30.00 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
5502 738 7307 S Operating Conditions -40 °C to +60 °C; IP67 water & dust protection 0 0
6185 738 7803 S Operating Conditions -30°C to 60°C, Humidity ≤ 95% (non-condensing) 0 0
5647 738 7480 S Operating Conditions −30°C to +60°C; housing rated IP67 (weatherproof), IK08 (vandal-resistant) 0 0
5363 738 7079 S Operating Conditions −40°C to +60°C, humidity ≤ 90% non-condensing 0 0
5594 738 7410 S Operating Conditions -30°C to +60°C, Humidity ≤ 95% non-condensing, IP67 rated for dust & water resistance 0 0
6146 738 7827 S Operating Conditions -40°C to 60°C, Humidity ≤ 90% (non-condensing) 0 0
5594 645 0.00 7412 S Ports Ethernet RJ-45 10/100M, power via PoE or 12 VDC 0 110
5363 645 7080 S Ports One video output port switchable among TVI / AHD / CVI / CVBS 0 110
5333 645 7035 S Ports Video output switchable BNC (TVI/AHD/CVI/CVBS) 0 110
6114 645 1.00 7805 S Ports 1 × RJ45 10M/100M Ethernet Port 0 110
5502 645 7301 S Ports 1 x HD analog output 0 110
6185 645 7805 S Ports 1 × RJ45 10M/100M Ethernet Port 0 110
5647 645 1.00 7481 S Ports 1 × microSD card slot (supports microSD/microSDHC/microSDXC up to 512 GB) 0 110
6114 642 6.00 7804 S Resolution 6 MP (3072 × 2048) 0 50
5502 642 7300 S Resolution 3K (2960 × 1665) 0 50
5647 642 7235 S Resolution 8 MP (3840 × 2160) 4K UHD 0 50
5333 642 7017 S Resolution 2 MP (1920 × 1080) Full HD 0 50
6185 642 7017 S Resolution 2 MP (1920 × 1080) Full HD 0 50
5363 642 7017 S Resolution 2 MP (1920 × 1080) Full HD 0 50
5594 642 7411 S Resolution 6 MP (3200 × 1800) Full HD 0 50
6146 642 7300 S Resolution 3K (2960 × 1665) 0 50
6185 646 7019 S Sensor 1/2.8" Progressive Scan CMOS 0 130
5594 646 1.00 7413 S Sensor 1/2.4″ Progressive Scan CMOS 0 130
5333 646 7023 S Sensor 2 MP CMOS 0 130
5363 646 7023 S Sensor 2 MP CMOS 0 130
6114 646 7482 S Sensor 1/2.7" Progressive Scan CMOS 0 130
5502 646 7302 S Sensor 3K CMOS 0 130
5647 646 1.00 7482 S Sensor 1/2.7" Progressive Scan CMOS 0 130
5333 648 0.00 7036 S Storage Uses external DVRs or recorders compatible with its analog outputs 0 170
5363 648 7036 S Storage Uses external DVRs or recorders compatible with its analog outputs 0 170
6114 648 0.00 7806 S Storage Supports microSD/SDHC/SDXC card, up to 256 GB 0 170
5502 648 7036 S Storage Uses external DVRs or recorders compatible with its analog outputs 0 170
5647 648 7428 S Storage On-board storage via microSD up to 512 GB 0 170
5594 648 0.00 7414 S Storage Local storage via microSD up to 512 GB (in “-F” variants); standard models may not include card slot 0 170
6185 648 7806 S Storage Supports microSD/SDHC/SDXC card, up to 256 GB 0 170