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 (
    5640, 5187, 5186, 5112, 5671, 5259, 5571, 
    5197, 5574, 5678, 5109, 5261, 5673, 
    5545, 5554, 5188, 5677, 5561, 5119, 
    5120, 5676, 5580, 5575, 5573
  ) 
  AND f.display_on_catalog = 'Y' 
  AND (
    f.categories_path = '' 
    OR FIND_IN_SET(250, f.categories_path) 
    OR FIND_IN_SET(372, f.categories_path) 
    OR FIND_IN_SET(552, f.categories_path) 
    OR FIND_IN_SET(553, f.categories_path) 
    OR FIND_IN_SET(555, f.categories_path) 
    OR FIND_IN_SET(557, f.categories_path) 
    OR FIND_IN_SET(560, f.categories_path) 
    OR FIND_IN_SET(562, 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.00544

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "281.06"
    },
    "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": 453,
            "rows_produced_per_join": 147,
            "filtered": "32.51",
            "index_condition": "(`softwarepirmam_hewadelivard_cscart_4`.`v`.`product_id` in (5640,5187,5186,5112,5671,5259,5571,5197,5574,5678,5109,5261,5673,5545,5554,5188,5677,5561,5119,5120,5676,5580,5575,5573))",
            "cost_info": {
              "read_cost": "195.13",
              "eval_cost": "14.73",
              "prefix_cost": "209.86",
              "data_read_per_join": "113K"
            },
            "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": 14,
            "filtered": "9.53",
            "cost_info": {
              "read_cost": "36.82",
              "eval_cost": "1.40",
              "prefix_cost": "261.41",
              "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(250,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(372,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(552,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(553,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(555,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(557,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(560,`softwarepirmam_hewadelivard_cscart_4`.`f`.`categories_path`)) or (0 <> find_in_set(562,`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": 14,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.51",
              "eval_cost": "1.40",
              "prefix_cost": "266.32",
              "data_read_per_join": "31K"
            },
            "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": 14,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.51",
              "eval_cost": "1.40",
              "prefix_cost": "271.24",
              "data_read_per_join": "16K"
            },
            "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": 14,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.51",
              "eval_cost": "1.40",
              "prefix_cost": "276.15",
              "data_read_per_join": "42K"
            },
            "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": 14,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.51",
              "eval_cost": "1.40",
              "prefix_cost": "281.06",
              "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
5109 754 6809 S Blend Type 60% Arabica, 40% Robusta 0 0
5112 754 6812 S Blend Type 100% Arabica 0 0
5119 754 6812 S Blend Type 100% Arabica 0 0
5120 754 6812 S Blend Type 100% Arabica 0 0
5186 754 6812 S Blend Type 100% Arabica 0 0
5187 754 6850 S Blend Type 80% Arabica, 20% Robusta 0 0
5188 754 6803 S Blend Type 70% Arabica, 30% Robusta 0 0
5197 754 6845 S Blend Type 50% Arabica, 50% Robusta 0 0
5259 754 6809 S Blend Type 60% Arabica, 40% Robusta 0 0
5261 754 6812 S Blend Type 100% Arabica 0 0
5545 754 6845 S Blend Type 50% Arabica, 50% Robusta 0 0
5554 754 7349 S Blend Type 100% Robusta beans 0 0
5561 754 7373 S Blend Type Instant cappuccino drink mix (powdered) 0 0
5571 754 7385 S Blend Type Powdered chocolate drink / hot chocolate mix 0 0
5573 754 7392 S Blend Type White chocolate beverage mix 0 0
5574 754 7396 S Blend Type Vanilla milkshake beverage mix 0 0
5575 754 7399 S Blend Type Black tea blend with cardamom 0 0
5580 754 7403 S Blend Type Black tea latte beverage mix 0 0
5640 754 7465 S Blend Type Black tea blend with natural lemon flavor 0 0
5671 754 7476 S Blend Type Premium chocolate drink mix (cocoa powder blend) 0 0
5673 754 7496 S Blend Type Premium powdered milk topping blend 0 0
5676 754 7504 S Blend Type 100% instant coffee 0 0
5677 754 7504 S Blend Type 100% instant coffee 0 0
5678 754 7504 S Blend Type 100% instant coffee 0 0
5109 752 6804 S Coffee Type Whole Beans 0 0
5112 752 6804 S Coffee Type Whole Beans 0 0
5119 752 6804 S Coffee Type Whole Beans 0 0
5120 752 6838 S Coffee Type Ground Coffee 0 0
5186 752 6804 S Coffee Type Whole Beans 0 0
5187 752 6804 S Coffee Type Whole Beans 0 0
5188 752 6804 S Coffee Type Whole Beans 0 0
5197 752 6804 S Coffee Type Whole Beans 0 0
5259 752 6804 S Coffee Type Whole Beans 0 0
5261 752 6804 S Coffee Type Whole Beans 0 0
5545 752 7341 S Coffee Type Arabica / roasted whole beans 0 0
5554 752 7350 S Coffee Type Whole roasted coffee beans 0 0
5561 752 7374 S Coffee Type Cappuccino classic – a mix (coffee + creamer + sugar) 0 0
5573 752 7393 S Coffee Type crafted as a pure white chocolate drink base, perfect on its own or for mixing with espresso for mochas. 0 0
5676 752 7500 S Coffee Type Instant coffee 0 0
5677 752 7500 S Coffee Type Instant coffee 0 0
5678 752 7500 S Coffee Type Instant coffee 0 0
5109 755 6831 S Flavor Notes Dark Chocolate, Roasted Nuts 0 0
5112 755 6821 S Flavor Notes Floral, Fruity, Chocolate 0 0
5119 755 6813 S Flavor Notes Spicy, Floral, Fruity 0 0
5120 755 6805 S Flavor Notes Chocolate, Caramel, Nutty 0 0
5186 755 6852 S Flavor Notes Floral, Fruity, Honey 0 0
5187 755 6851 S Flavor Notes Chocolate, Caramel, Fruity 0 0
5188 755 6805 S Flavor Notes Chocolate, Caramel, Nutty 0 0
5197 755 6805 S Flavor Notes Chocolate, Caramel, Nutty 0 0
5259 755 6860 S Flavor Notes Honey, Dried Fruits, Almonds 0 0
5261 755 6863 S Flavor Notes Caramel, Chocolate, Tropical Fruits 0 0
5545 755 7342 S Flavor Notes Mild, creamy profile (the name “Cremoso” implies creaminess) 0 0
5554 755 7351 S Flavor Notes Mild flavored espresso with a hint of aromatic flavor 0 0
5561 755 7375 S Flavor Notes Classic cappuccino flavor — mild, creamy cappuccino with balanced taste 0 0
5571 755 7386 S Flavor Notes Mild chocolate flavor with balanced sweetness 0 0
5573 755 7394 S Flavor Notes Creamy, sweet, with delicate vanilla-like undertones 0 0
5574 755 7397 S Flavor Notes Smooth, creamy, and sweet with authentic vanilla flavor 0 0
5575 755 7400 S Flavor Notes Rich black tea, warm cardamom spice, slightly sweet and aromatic 0 0
5580 755 7404 S Flavor Notes Robust black tea, creamy milk, subtle sweetness, smooth and aromatic 0 0
5640 755 7466 S Flavor Notes Bright citrus, zesty lemon, smooth black tea, light sweetness 0 0
5671 755 7488 S Flavor Notes Deep cocoa, smooth creaminess, balanced sweetness, rich finish 0 0
5673 755 7497 S Flavor Notes Creamy, milky, smooth texture with a subtle sweetness 0 0
5676 755 7505 S Flavor Notes Smooth, balanced body, mild bitterness, subtle roasted aroma 0 0
5677 755 7506 S Flavor Notes Full-bodied, smooth, balanced bitterness, pleasant roasted aroma 0 0
5678 755 7509 S Flavor Notes Rich aroma, smooth body, balanced bitterness, subtle roasted notes 0 0
5109 740 6830 S Intensity 10/10 0 0
5112 740 6817 S Intensity 6/10 0 0
5119 740 6814 S Intensity 7/10 0 0
5120 740 6836 S Intensity 4/10 0 0
5186 740 6814 S Intensity 7/10 0 0
5187 740 6814 S Intensity 7/10 0 0
5188 740 6810 S Intensity 8/10 0 0
5197 740 6810 S Intensity 8/10 0 0
5259 740 6817 S Intensity 6/10 0 0
5261 740 6814 S Intensity 7/10 0 0
5554 740 7352 S Intensity Balanced taste with slight bitterness (not extremely strong) 0 0
5561 740 7376 S Intensity Mild to moderate — not overly strong, suitable for casual consumption. 0 0
5571 740 7387 S Intensity Mild to moderate; not too strong, more dessert-style sweetness than bitterness 0 0
5573 740 7395 S Intensity Mild and smooth 0 0
5574 740 7398 S Intensity Mild and refreshing 0 0
5575 740 7206 S Intensity Medium 0 0
5580 740 7405 S Intensity Mediu 0 0
5640 740 7206 S Intensity Medium 0 0
5671 740 7489 S Intensity Medium to high (robust chocolate flavor) 0 0
5673 740 7498 S Intensity Light to medium (enhances drink texture without overpowering flavor) 0 0
5676 740 7206 S Intensity Medium 0 0
5677 740 7507 S Intensity Medium to strong 0 0
5678 740 7507 S Intensity Medium to strong 0 0
5109 753 6826 S Roast Level Dark 0 0
5112 753 6811 S Roast Level Medium 0 0
5119 753 6811 S Roast Level Medium 0 0
5120 753 6811 S Roast Level Medium 0 0
5186 753 6811 S Roast Level Medium 0 0
5187 753 6811 S Roast Level Medium 0 0
5188 753 6811 S Roast Level Medium 0 0
5197 753 6811 S Roast Level Medium 0 0
5259 753 6811 S Roast Level Medium 0 0
5261 753 6811 S Roast Level Medium 0 0
5545 753 0.00 7343 S Roast Level Likely a medium to medium-dark roast 0 0
5554 753 7207 S Roast Level Medium roast 0 0
5676 753 7207 S Roast Level Medium roast 0 0
5677 753 7508 S Roast Level Medium to dark roast 0 0
5678 753 7207 S Roast Level Medium roast 0 0
5109 756 6808 S Weight 1 kg 0 0
5112 756 6808 S Weight 1 kg 0 0
5119 756 6808 S Weight 1 kg 0 0
5120 756 250.00 6839 S Weight 250 g 0 0
5186 756 6808 S Weight 1 kg 0 0
5187 756 6808 S Weight 1 kg 0 0
5188 756 6808 S Weight 1 kg 0 0
5197 756 6808 S Weight 1 kg 0 0
5259 756 6808 S Weight 1 kg 0 0
5261 756 6808 S Weight 1 kg 0 0
5545 756 1.00 7344 S Weight 1 kg bag 0 0
5554 756 6808 S Weight 1 kg 0 0
5561 756 6808 S Weight 1 kg 0 0
5571 756 6808 S Weight 1 kg 0 0
5573 756 6808 S Weight 1 kg 0 0
5574 756 6808 S Weight 1 kg 0 0
5575 756 6808 S Weight 1 kg 0 0
5580 756 6808 S Weight 1 kg 0 0
5640 756 6808 S Weight 1 kg 0 0
5671 756 6808 S Weight 1 kg 0 0
5673 756 6808 S Weight 1 kg 0 0
5676 756 6837 S Weight 500 g 0 0
5677 756 6837 S Weight 500 g 0 0
5678 756 6837 S Weight 500 g 0 0
5109 657 6802 E ماركة Bristot 0 0
5112 657 6802 E ماركة Bristot 0 0
5119 657 6802 E ماركة Bristot 0 0
5120 657 6802 E ماركة Bristot 0 0
5186 657 6849 E ماركة Trucillo 0 0
5187 657 6849 E ماركة Trucillo 0 0
5188 657 6849 E ماركة Trucillo 0 0
5197 657 6849 E ماركة Trucillo 0 0
5259 657 6861 E ماركة Lavazza 0 0
5261 657 6861 E ماركة Lavazza 0 0
5545 657 7340 E ماركة DARKOFF 0 0
5554 657 7340 E ماركة DARKOFF 0 0
5561 657 7340 E ماركة DARKOFF 0 0
5571 657 7340 E ماركة DARKOFF 0 0
5573 657 7340 E ماركة DARKOFF 0 0
5574 657 7340 E ماركة DARKOFF 0 0
5575 657 7340 E ماركة DARKOFF 0 0
5580 657 7340 E ماركة DARKOFF 0 0
5640 657 7340 E ماركة DARKOFF 0 0
5671 657 7340 E ماركة DARKOFF 0 0
5673 657 7346 E ماركة Satro 0 0
5676 657 7340 E ماركة DARKOFF 0 0
5677 657 7340 E ماركة DARKOFF 0 0
5678 657 7340 E ماركة DARKOFF 0 0