SELECT 
  SQL_CALC_FOUND_ROWS (
    CASE WHEN products.parent_product_id <> 0 THEN products.parent_product_id ELSE products.product_id END
  ) AS product_id, 
  IF(
    shared_descr.product_id IS NOT NULL, 
    shared_descr.product, descr1.product
  ) as product, 
  companies.company as company_name, 
  GROUP_CONCAT(
    products.product_id 
    ORDER BY 
      products.parent_product_id ASC, 
      products.product_id ASC
  ) AS product_ids, 
  GROUP_CONCAT(
    products.product_type 
    ORDER BY 
      products.parent_product_id ASC, 
      products.product_id ASC
  ) AS product_types, 
  GROUP_CONCAT(
    products.parent_product_id 
    ORDER BY 
      products.parent_product_id ASC, 
      products.product_id ASC
  ) AS parent_product_ids, 
  products.product_type, 
  products.parent_product_id 
FROM 
  cscart_products as products 
  LEFT JOIN cscart_product_features_values as var_val_18 ON var_val_18.product_id = products.product_id 
  AND var_val_18.lang_code = 'en' 
  AND var_val_18.feature_id = 18 
  LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN cscart_companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  AND cscart_categories.storefront_id IN (0, 1) 
  LEFT JOIN cscart_ult_product_descriptions shared_descr ON shared_descr.product_id = products.product_id 
  AND shared_descr.company_id = 1 
  AND shared_descr.lang_code = 'en' 
WHERE 
  1 
  AND (
    var_val_18.variant_id IN (2382)
  ) 
  AND cscart_categories.category_id IN (306) 
  AND companies.status IN ('A') 
  AND (
    products.usergroup_ids = '' 
    OR FIND_IN_SET(0, products.usergroup_ids) 
    OR FIND_IN_SET(1, products.usergroup_ids)
  ) 
  AND products.status IN ('A') 
  AND prices.usergroup_id IN (0, 0, 1) 
GROUP BY 
  product_id 
ORDER BY 
  product asc, 
  products.product_id ASC 
LIMIT 
  0, 48

Query time 0.02527

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "1660.28"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": true,
        "buffer_result": {
          "using_temporary_table": true,
          "nested_loop": [
            {
              "table": {
                "table_name": "cscart_categories",
                "access_type": "const",
                "possible_keys": [
                  "PRIMARY",
                  "c_status",
                  "p_category_id"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "category_id"
                ],
                "key_length": "3",
                "ref": [
                  "const"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 1,
                "filtered": "100.00",
                "cost_info": {
                  "read_cost": "0.00",
                  "eval_cost": "0.10",
                  "prefix_cost": "0.00",
                  "data_read_per_join": "4K"
                },
                "used_columns": [
                  "category_id",
                  "storefront_id",
                  "usergroup_ids",
                  "status"
                ]
              }
            },
            {
              "table": {
                "table_name": "companies",
                "access_type": "ALL",
                "possible_keys": [
                  "PRIMARY"
                ],
                "rows_examined_per_scan": 2,
                "rows_produced_per_join": 1,
                "filtered": "50.00",
                "cost_info": {
                  "read_cost": "0.62",
                  "eval_cost": "0.10",
                  "prefix_cost": "0.72",
                  "data_read_per_join": "5K"
                },
                "used_columns": [
                  "company_id",
                  "status",
                  "company"
                ],
                "attached_condition": "(`gaseus`.`companies`.`status` = 'A')"
              }
            },
            {
              "table": {
                "table_name": "var_val_18",
                "access_type": "ref",
                "possible_keys": [
                  "PRIMARY",
                  "fl",
                  "variant_id",
                  "lang_code",
                  "product_id",
                  "fpl",
                  "idx_product_feature_variant_id"
                ],
                "key": "fl",
                "used_key_parts": [
                  "feature_id",
                  "lang_code",
                  "variant_id"
                ],
                "key_length": "12",
                "ref": [
                  "const",
                  "const",
                  "const"
                ],
                "rows_examined_per_scan": 1401,
                "rows_produced_per_join": 1401,
                "filtered": "100.00",
                "cost_info": {
                  "read_cost": "350.25",
                  "eval_cost": "140.10",
                  "prefix_cost": "491.07",
                  "data_read_per_join": "1M"
                },
                "used_columns": [
                  "feature_id",
                  "product_id",
                  "variant_id",
                  "lang_code"
                ],
                "attached_condition": "(`gaseus`.`var_val_18`.`product_id` is not null)"
              }
            },
            {
              "table": {
                "table_name": "products_categories",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "pt"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "category_id",
                  "product_id"
                ],
                "key_length": "6",
                "ref": [
                  "const",
                  "gaseus.var_val_18.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 1401,
                "filtered": "100.00",
                "using_index": true,
                "cost_info": {
                  "read_cost": "350.25",
                  "eval_cost": "140.10",
                  "prefix_cost": "981.42",
                  "data_read_per_join": "21K"
                },
                "used_columns": [
                  "product_id",
                  "category_id"
                ]
              }
            },
            {
              "table": {
                "table_name": "products",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "status"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "product_id"
                ],
                "key_length": "3",
                "ref": [
                  "gaseus.var_val_18.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 140,
                "filtered": "10.00",
                "cost_info": {
                  "read_cost": "350.25",
                  "eval_cost": "14.00",
                  "prefix_cost": "1471.77",
                  "data_read_per_join": "914K"
                },
                "used_columns": [
                  "product_id",
                  "product_type",
                  "status",
                  "company_id",
                  "usergroup_ids",
                  "parent_product_id"
                ],
                "attached_condition": "((`gaseus`.`products`.`company_id` = `gaseus`.`companies`.`company_id`) and ((`gaseus`.`products`.`usergroup_ids` = '') or (0 <> find_in_set(0,`gaseus`.`products`.`usergroup_ids`)) or (0 <> find_in_set(1,`gaseus`.`products`.`usergroup_ids`))) and (`gaseus`.`products`.`status` = 'A'))"
              }
            },
            {
              "table": {
                "table_name": "prices",
                "access_type": "ref",
                "possible_keys": [
                  "usergroup",
                  "product_id",
                  "lower_limit",
                  "usergroup_id"
                ],
                "key": "usergroup",
                "used_key_parts": [
                  "product_id"
                ],
                "key_length": "3",
                "ref": [
                  "gaseus.var_val_18.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 140,
                "filtered": "99.97",
                "using_index": true,
                "cost_info": {
                  "read_cost": "35.01",
                  "eval_cost": "14.00",
                  "prefix_cost": "1520.79",
                  "data_read_per_join": "3K"
                },
                "used_columns": [
                  "product_id",
                  "lower_limit",
                  "usergroup_id"
                ],
                "attached_condition": "((`gaseus`.`prices`.`lower_limit` = 1) and (`gaseus`.`prices`.`usergroup_id` in (0,0,1)))"
              }
            },
            {
              "table": {
                "table_name": "shared_descr",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "product_id",
                  "company_id"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "product_id",
                  "lang_code",
                  "company_id"
                ],
                "key_length": "13",
                "ref": [
                  "gaseus.var_val_18.product_id",
                  "const",
                  "const"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 140,
                "filtered": "100.00",
                "cost_info": {
                  "read_cost": "41.20",
                  "eval_cost": "14.00",
                  "prefix_cost": "1575.99",
                  "data_read_per_join": "533K"
                },
                "used_columns": [
                  "product_id",
                  "lang_code",
                  "company_id",
                  "product"
                ]
              }
            },
            {
              "table": {
                "table_name": "descr1",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "product_id"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "product_id",
                  "lang_code"
                ],
                "key_length": "9",
                "ref": [
                  "gaseus.var_val_18.product_id",
                  "const"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 140,
                "filtered": "100.00",
                "cost_info": {
                  "read_cost": "70.29",
                  "eval_cost": "14.00",
                  "prefix_cost": "1660.29",
                  "data_read_per_join": "638K"
                },
                "used_columns": [
                  "product_id",
                  "lang_code",
                  "product"
                ]
              }
            }
          ]
        }
      }
    }
  }
}

Result

product_id product company_name product_ids product_types parent_product_ids product_type parent_product_id
10921 Cylinder pressure regulator Sigma Gaseus 10921 P 0 P 0
10922 Cylinder pressure regulator Sigma Gaseus 10922 P 0 P 0
10923 Cylinder pressure regulator Sigma Gaseus 10923 P 0 P 0
10924 Cylinder pressure regulator Sigma Gaseus 10924 P 0 P 0
10925 Cylinder pressure regulator Sigma Gaseus 10925 P 0 P 0
10926 Cylinder pressure regulator Sigma Gaseus 10926 P 0 P 0
10927 Cylinder pressure regulator Sigma Gaseus 10927 P 0 P 0
10928 Cylinder pressure regulator Sigma Gaseus 10928 P 0 P 0
10929 Cylinder pressure regulator Sigma Gaseus 10929 P 0 P 0
10930 Cylinder pressure regulator Sigma Gaseus 10930 P 0 P 0
10931 Cylinder pressure regulator Sigma Gaseus 10931 P 0 P 0
10932 Cylinder pressure regulator Sigma Gaseus 10932 P 0 P 0
10933 Cylinder pressure regulator Sigma Gaseus 10933 P 0 P 0
10934 Cylinder pressure regulator Sigma Gaseus 10934 P 0 P 0
10935 Cylinder pressure regulator Sigma Gaseus 10935 P 0 P 0
10936 Cylinder pressure regulator Sigma Gaseus 10936 P 0 P 0
10937 Cylinder pressure regulator Sigma Gaseus 10937 P 0 P 0
10938 Cylinder pressure regulator Sigma Gaseus 10938 P 0 P 0
10939 Cylinder pressure regulator Sigma Gaseus 10939 P 0 P 0
10940 Cylinder pressure regulator Sigma Gaseus 10940 P 0 P 0
10941 Cylinder pressure regulator Sigma Gaseus 10941 P 0 P 0
10942 Cylinder pressure regulator Sigma Gaseus 10942 P 0 P 0
10943 Cylinder pressure regulator Sigma Gaseus 10943,10944,10945,10946,10947,10948,10949,10950,10951,10952,10953,10954,10955,10956,10957,10958,10959,10960,10961,10962,10963,10964 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943,10943 P 10943
10965 Cylinder pressure regulator Sigma Gaseus 10965,10966,10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982,10983,10984 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965,10965 P 10965
10985 Cylinder pressure regulator Sigma Gaseus 10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998,10999,11000,11001,11002,11003,11004 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985,10985 P 10985
11005 Cylinder pressure regulator Sigma Gaseus 11005,11006,11007,11008,11009,11010,11011,11012,11013,11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005,11005 P 11005
11027 Cylinder pressure regulator Sigma Gaseus 11027,11028,11029,11030,11031,11032,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044,11045,11046 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027,11027 P 11027
11047 Cylinder pressure regulator Sigma Gaseus 11047,11048,11049,11050,11051,11052,11053,11054,11055,11056,11057,11058,11059,11060,11061,11062,11063,11064,11065,11066 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047,11047 P 11047
11067 Cylinder pressure regulator Sigma Gaseus 11067,11068,11069,11070,11071,11072,11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067,11067 P 11067
11089 Cylinder pressure regulator Sigma Gaseus 11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104,11105,11106,11107,11108,11109,11110 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089,11089 P 11089
11111 Cylinder pressure regulator Sigma Gaseus 11111,11112,11113,11114,11115,11116,11117,11118,11119,11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111 P 11111
11133 Cylinder pressure regulator Sigma Gaseus 11133,11134,11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150,11151,11152 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133,11133 P 11133
11153 Cylinder pressure regulator Sigma Gaseus 11153,11154,11155,11156,11157,11158,11159,11160,11161,11162,11163,11164,11165,11166,11167,11168,11169,11170,11171,11172 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153,11153 P 11153
11173 Cylinder pressure regulator Sigma Gaseus 11173,11174,11175,11176,11177,11178,11179,11180,11181,11182,11183,11184,11185,11186,11187,11188,11189,11190,11191,11192,11193,11194 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173,11173 P 11173
11195 Cylinder pressure regulator Sigma Gaseus 11195,11196,11197,11198,11199,11200,11201,11202,11203,11204,11205,11206,11207,11208,11209,11210,11211,11212,11213,11214 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195,11195 P 11195
11215 Cylinder pressure regulator Sigma Gaseus 11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225,11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215,11215 P 0
11237 Cylinder pressure regulator Sigma Gaseus 11237,11238,11239,11240,11241,11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,11252,11253,11254,11255,11256,11257,11258 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237,11237 P 11237
11259 Cylinder pressure regulator Sigma Gaseus 11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272,11273,11274,11275,11276,11277,11278 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259,11259 P 11259
11279 Cylinder pressure regulator Sigma Gaseus 11279,11280,11281,11282,11283,11284,11285,11286,11287,11288,11289,11290,11291,11292,11293,11294,11295,11296,11297,11298 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279,11279 P 11279
11299 Cylinder pressure regulator Sigma Gaseus 11299,11300,11301,11302,11303,11304,11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,11315,11316,11317,11318,11319 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299,11299 P 11299
11813 Cylinder pressure regulator Sigma Gaseus 11813,11814,11815,11816,11817,11818 P,V,V,V,V,V 0,11813,11813,11813,11813,11813 V 11813
11819 Cylinder pressure regulator Sigma Gaseus 11819,11820,11821,11822,11823,11824 P,P,P,P,P,P 0,11819,11819,11819,11819,11819 P 11819
11825 Cylinder pressure regulator Sigma Gaseus 11825,11826,11827,11828,11829,11830 P,P,P,P,P,P 0,11825,11825,11825,11825,11825 P 11825
11831 Cylinder pressure regulator Sigma Gaseus 11831,11832,11833,11834,11835,11836,11837 P,P,P,P,P,P,P 0,11831,11831,11831,11831,11831,11831 P 11831
11838 Cylinder pressure regulator Sigma Gaseus 11838,11839,11840,11841,11842,11843 P,P,P,P,P,P 0,11838,11838,11838,11838,11838 P 11838
11844 Cylinder pressure regulator Sigma Gaseus 11844,11845,11846,11847,11848,11849,11850 P,P,P,P,P,P,P 0,11844,11844,11844,11844,11844,11844 P 11844
11851 Cylinder pressure regulator Sigma Gaseus 11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866,11867,11868 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851,11851 P 11851
11869 Cylinder pressure regulator Sigma Gaseus 11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882,11883,11884,11885,11886 P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P 0,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869,11869 P 11869