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 (
    4138, 4184, 5025, 4177, 4119, 4196, 4343, 
    4139, 4211, 4356, 4140, 4286, 4288, 
    4594, 4552, 4179, 4638, 4208, 4300, 
    4593, 4640, 4907, 4906, 4502, 4890, 
    4596, 4586
  ) 
  AND f.display_on_catalog = 'Y' 
  AND (
    f.categories_path = '' 
    OR FIND_IN_SET(166, f.categories_path) 
    OR FIND_IN_SET(513, f.categories_path) 
    OR FIND_IN_SET(517, 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.00638

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "310.34"
    },
    "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": 500,
            "rows_produced_per_join": 162,
            "filtered": "32.51",
            "index_condition": "(((`softwarepirmam_hewadelivard_cscart_4`.`v`.`product_id` in (4138,4184,5025,4177,4119,4196,4343,4139,4211,4356,4140,4286,4288,4594,4552,4179,4638,4208,4300,4593,4640,4907,4906,4502,4890,4596,4586)) and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`lang_code` = 'ar')) and (`softwarepirmam_hewadelivard_cscart_4`.`v`.`feature_id` is not null))",
            "cost_info": {
              "read_cost": "215.50",
              "eval_cost": "16.26",
              "prefix_cost": "231.76",
              "data_read_per_join": "125K"
            },
            "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": 15,
            "filtered": "9.53",
            "cost_info": {
              "read_cost": "40.64",
              "eval_cost": "1.55",
              "prefix_cost": "288.66",
              "data_read_per_join": "6K"
            },
            "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(513,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(517,`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": 15,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.87",
              "eval_cost": "1.55",
              "prefix_cost": "294.08",
              "data_read_per_join": "35K"
            },
            "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": 15,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.87",
              "eval_cost": "1.55",
              "prefix_cost": "299.50",
              "data_read_per_join": "17K"
            },
            "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": 15,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.87",
              "eval_cost": "1.55",
              "prefix_cost": "304.92",
              "data_read_per_join": "46K"
            },
            "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": 15,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.87",
              "eval_cost": "1.55",
              "prefix_cost": "310.35",
              "data_read_per_join": "6K"
            },
            "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
4119 727 5187 S Data Security Supports built-in Error Correction Code (ECC) to detect and fix transfer errors; RoHS compliant; water-proof, X-ray proof, magnet-proof, and temperature resistant 0 0
4138 727 5192 S Data Security supports OS-based password protection and encryption if configured 0 0
4139 727 5192 S Data Security supports OS-based password protection and encryption if configured 0 0
4140 727 5192 S Data Security supports OS-based password protection and encryption if configured 0 0
4177 727 5260 S Data Security Reliable storage with error correction support 0 0
4179 727 5268 S Data Security Water, shock, and X-ray resistant 0 0
4184 727 5282 S Data Security Reliable storage with error correction and long-lasting performance 0 0
4196 727 5183 S Data Security AES 256-bit encryption support 0 0
4208 727 5333 S Data Security Water, temperature, and X-ray resistant 0 0
4211 727 5333 S Data Security Water, temperature, and X-ray resistant 0 0
4286 727 5441 S Data Security Reliable storage for photos, videos, and important files 0 0
4288 727 5441 S Data Security Reliable storage for photos, videos, and important files 0 0
4300 727 5468 S Data Security Waterproof, shockproof, X-ray-proof, temperature-resistant (−25 °C to 85 °C) 0 0
4343 727 0.00 5685 S Data Security ECC (Error Correcting Code) 0 0
4356 727 5510 S Data Security Password protection and file encryption 0 0
4502 727 5567 S Data Security Supports OS based password protection and encryption if configured 0 0
4552 727 5631 S Data Security Supports advanced error correction (ECC) and reliable data integrity 0 0
4586 727 5722 S Data Security Standard flash storage 0 0
4593 727 5734 S Data Security Standard SD card, no built-in hardware encryption 0 0
4594 727 5734 S Data Security Standard SD card, no built-in hardware encryption 0 0
4596 727 5734 S Data Security Standard SD card, no built-in hardware encryption 0 0
4638 727 5839 S Data Security Built-in error correction and reliable data retention 0 0
4640 727 5846 S Data Security Built-in error correction (ECC) for reliable data retention 0 0
4906 727 6232 S Data Security Built-in write-protect switch 0 0
4907 727 6233 S Data Security Built-in write-protect switch on adapter 0 0
4119 645 5189 S Ports microSD card edge connector; via adapter, fits standard SD card slot 0 110
4138 645 5205 S Ports microSDXC (with SD adapter included) 0 110
4139 645 5205 S Ports microSDXC (with SD adapter included) 0 110
4140 645 5205 S Ports microSDXC (with SD adapter included) 0 110
4177 645 5262 S Ports microSD interface with SD adapter for flexibility 0 110
4179 645 5270 S Ports Includes SD adapter 0 110
4184 645 5284 S Ports MicroSDXC with included SD adapter for compatibility with SD slots 0 110
4196 645 5304 S Ports microSDXC/SDHC with included SD adapter for compatibility with SD slots 0 110
4208 645 5335 S Ports microSD with SD adapter (UHS-I, SD 5.1) 0 110
4211 645 5339 S Ports SD card, UHS-I, SD 5. 0 110
4286 645 5443 S Ports microSDXC/SDHC, includes SD adapter, UHS-I 0 110
4288 645 5450 S Ports SDXC UHS-I compatible with SD card slots 0 110
4300 645 5470 S Ports Includes SD adapter for standard SD slots 0 110
4343 645 5490 S Ports SDXC UHS-I interface 0 110
4356 645 5512 S Ports SD7.1 Express microSDXC 0 110
4502 645 5593 S Ports SD Express PCIe Gen3 interface, UHS-I 0 110
4552 645 5633 S Ports microSDXC (with SD adapter for standard SD slot) 0 110
4586 645 5724 S Ports SD Express (PCIe Gen3 x1 / NVMe 1.3) compatible with UHS-I 0 110
4593 645 5736 S Ports SD UHS-II interface 0 110
4594 645 5737 S Ports SD interface, UHS-I compatible 0 110
4596 645 5736 S Ports SD UHS-II interface 0 110
4638 645 5841 S Ports MicroSDXC interface (UHS-I U3, Class 10, V30) 0 110
4640 645 5848 S Ports SDXC interface, UHS-II U3, Class 10, V90 0 110
4119 726 5188 S Shok Sensor Protection solid-state flash memory design for resistance against physical shock and vibration 0 0
4138 726 5204 S Shok Sensor Protection Solid-state flash memory makes it resistant to vibration and minor physical shocks 0 0
4139 726 5204 S Shok Sensor Protection Solid-state flash memory makes it resistant to vibration and minor physical shocks 0 0
4140 726 5204 S Shok Sensor Protection Solid-state flash memory makes it resistant to vibration and minor physical shocks 0 0
4177 726 5261 S Shok Sensor Protection Built to withstand impacts and rough handling 0 0
4179 726 5269 S Shok Sensor Protection Built-in durability to protect data from drops, knocks, and vibration 0 0
4184 726 5283 S Shok Sensor Protection Durable and resistant to physical impact 0 0
4196 726 5283 S Shok Sensor Protection Durable and resistant to physical impact 0 0
4208 726 5334 S Shok Sensor Protection Resistant to shock and impact 0 0
4211 726 5334 S Shok Sensor Protection Resistant to shock and impact 0 0
4286 726 5442 S Shok Sensor Protection Durable design protects against accidental handling 0 0
4288 726 5449 S Shok Sensor Protection Durable design resists shock, water, and temperature variations 0 0
4300 726 5469 S Shok Sensor Protection N/A (no built-in sensor) 0 0
4343 726 0.00 5686 S Shok Sensor Protection protects data from drops and impacts 0 0
4356 726 5511 S Shok Sensor Protection Durable and resistant to shock 0 0
4502 726 5584 S Shok Sensor Protection Durable flash memory makes it resistant to vibration and minor physical shocks 0 0
4552 726 5632 S Shok Sensor Protection Shock-resistant, temperature-proof, X-ray proof, and waterproof design 0 0
4586 726 5723 S Shok Sensor Protection Basic resistance (solid-state design, no moving parts) 0 0
4593 726 5735 S Shok Sensor Protection Solid-state memory, resistant to shocks and vibrations 0 0
4594 726 5735 S Shok Sensor Protection Solid-state memory, resistant to shocks and vibrations 0 0
4596 726 5735 S Shok Sensor Protection Solid-state memory, resistant to shocks and vibrations 0 0
4638 726 5840 S Shok Sensor Protection Resistant to shock, water, X-rays, and extreme temperatures 0 0
4640 726 5847 S Shok Sensor Protection Durable design resistant to shocks, water, X-rays, and extreme temperatures 0 0
4890 726 6218 S Shok Sensor Protection Shockproof, temperature-proof, waterproof, and X-ray proof 0 0
4906 726 6218 S Shok Sensor Protection Shockproof, temperature-proof, waterproof, and X-ray proof 0 0
4907 726 6234 S Shok Sensor Protection Temperature-proof, waterproof, shockproof, and X-ray proof 0 0
5025 726 5840 S Shok Sensor Protection Resistant to shock, water, X-rays, and extreme temperatures 0 0
4119 728 5522 S Storage type External 0 0
4138 728 5522 S Storage type External 0 0
4139 728 5522 S Storage type External 0 0
4140 728 5522 S Storage type External 0 0
4177 728 5522 S Storage type External 0 0
4179 728 5522 S Storage type External 0 0
4184 728 5522 S Storage type External 0 0
4196 728 5522 S Storage type External 0 0
4208 728 5522 S Storage type External 0 0
4211 728 5522 S Storage type External 0 0
4286 728 5522 S Storage type External 0 0
4288 728 5522 S Storage type External 0 0
4300 728 5522 S Storage type External 0 0
4343 728 5522 S Storage type External 0 0
4356 728 5522 S Storage type External 0 0
4502 728 5592 S Storage type SDXC memory card 0 0
4552 728 5522 S Storage type External 0 0
4586 728 5522 S Storage type External 0 0
4593 728 5522 S Storage type External 0 0
4594 728 5522 S Storage type External 0 0
4596 728 5522 S Storage type External 0 0
4638 728 5522 S Storage type External 0 0
4640 728 5522 S Storage type External 0 0
4906 728 5592 S Storage type SDXC memory card 0 0
4907 728 5585 S Storage type microSDXC memory card 0 0
4119 648 1686 S التخزين 32GB 0 170
4139 648 1687 S التخزين 64GB 0 170
4184 648 1687 S التخزين 64GB 0 170
4286 648 1687 S التخزين 64GB 0 170
4343 648 1687 S التخزين 64GB 0 170
4638 648 1687 S التخزين 64GB 0 170
4640 648 1687 S التخزين 64GB 0 170
4890 648 1687 S التخزين 64GB 0 170
4177 648 1561 S التخزين 128GB 0 170
4179 648 1561 S التخزين 128GB 0 170
4196 648 1561 S التخزين 128GB 0 170
4288 648 1561 S التخزين 128GB 0 170
4593 648 1561 S التخزين 128GB 0 170
4906 648 1561 S التخزين 128GB 0 170
4907 648 1561 S التخزين 128GB 0 170
4140 648 1562 S التخزين 256GB 0 170
4208 648 1562 S التخزين 256GB 0 170
4211 648 1562 S التخزين 256GB 0 170
4502 648 1562 S التخزين 256GB 0 170
4552 648 1562 S التخزين 256GB 0 170
4596 648 1562 S التخزين 256GB 0 170
5025 648 1562 S التخزين 256GB 0 170
4138 648 1563 S التخزين 512GB 0 170
4356 648 1563 S التخزين 512GB 0 170
4586 648 1563 S التخزين 512GB 0 170
4594 648 1563 S التخزين 512GB 0 170
4300 648 1564 S التخزين 1TB 0 170
4119 656 1560 S لون Black 0 160
4138 656 5206 S لون Standard microSD (black/grey) 0 160
4139 656 5206 S لون Standard microSD (black/grey) 0 160
4140 656 5206 S لون Standard microSD (black/grey) 0 160
4177 656 5263 S لون Grey with black accents 0 160
4179 656 1560 S لون Black 0 160
4184 656 5285 S لون Standard gray/black (typical for SD cards) 0 160
4196 656 5305 S لون Standard Red/black 0 160
4208 656 1560 S لون Black 0 160
4211 656 1560 S لون Black 0 160
4286 656 5444 S لون Red/black 0 160
4288 656 1600 S لون Blue 0 160
4300 656 1560 S لون Black 0 160
4343 656 1600 S لون Blue 0 160
4356 656 1600 S لون Blue 0 160
4502 656 1560 S لون Black 0 160
4552 656 1560 S لون Black 0 160
4586 656 5725 S لون Black with label design 0 160
4593 656 5725 S لون Black with label design 0 160
4594 656 5725 S لون Black with label design 0 160
4596 656 5725 S لون Black with label design 0 160
4638 656 5842 S لون Black with printed label 0 160
4640 656 5842 S لون Black with printed label 0 160
4890 656 1889 S لون Dark Gray 0 160
4906 656 1560 S لون Black 0 160
4907 656 1559 S لون White 0 160
5025 656 6396 S لون Red/Gray 0 160
4119 657 5176 E ماركة ADATA 0 0
4138 657 5176 E ماركة ADATA 0 0
4139 657 5176 E ماركة ADATA 0 0
4140 657 5176 E ماركة ADATA 0 0
4177 657 5176 E ماركة ADATA 0 0
4179 657 5176 E ماركة ADATA 0 0
4184 657 5176 E ماركة ADATA 0 0
4196 657 5176 E ماركة ADATA 0 0
4208 657 5176 E ماركة ADATA 0 0
4211 657 5176 E ماركة ADATA 0 0
4286 657 5176 E ماركة ADATA 0 0
4288 657 5176 E ماركة ADATA 0 0
4300 657 5176 E ماركة ADATA 0 0
4343 657 5176 E ماركة ADATA 0 0
4356 657 5176 E ماركة ADATA 0 0
4502 657 5176 E ماركة ADATA 0 0
4552 657 5176 E ماركة ADATA 0 0
4586 657 5176 E ماركة ADATA 0 0
4593 657 5176 E ماركة ADATA 0 0
4594 657 5176 E ماركة ADATA 0 0
4596 657 5176 E ماركة ADATA 0 0
4638 657 5176 E ماركة ADATA 0 0
4640 657 5176 E ماركة ADATA 0 0
4890 657 5498 E ماركة San Disk 0 0
4906 657 5498 E ماركة San Disk 0 0
4907 657 5498 E ماركة San Disk 0 0
5025 657 5498 E ماركة San Disk 0 0