SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  products.amount, 
  descr1.product as product, 
  companies.company as company_name, 
  variation_group_products.group_id AS variation_group_id, 
  products.product_type, 
  products.parent_product_id, 
  cscart_product_review_prepared_data.average_rating average_rating, 
  cscart_product_review_prepared_data.reviews_count product_reviews_count 
FROM 
  cscart_products as products 
  LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  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 
  INNER JOIN cscart_product_variation_group_products AS variation_group_products ON variation_group_products.product_id = products.product_id 
  LEFT JOIN cscart_product_review_prepared_data ON cscart_product_review_prepared_data.product_id = products.product_id 
  AND cscart_product_review_prepared_data.storefront_id = 0 
WHERE 
  1 
  AND companies.status IN ('A') 
  AND (
    products.amount > 0 
    OR products.tracking = 'D'
  ) 
  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 variation_group_products.group_id IN (
    12204, 15883, 13463, 17018, 13598, 13149, 
    12972, 17354, 12622, 13437, 14381, 
    12863, 14212, 13663, 15890, 13685, 
    13420, 17283, 13469
  ) 
GROUP BY 
  products.product_id 
ORDER BY 
  NULL asc

Query time 0.06399

JSON explain

{
  "query_block": {
    "select_id": 1,
    "temporary_table": {
      "nested_loop": [
        {
          "table": {
            "table_name": "variation_group_products",
            "access_type": "range",
            "possible_keys": ["PRIMARY", "idx_group_id"],
            "key": "idx_group_id",
            "key_length": "3",
            "used_key_parts": ["group_id"],
            "rows": 81,
            "filtered": 100,
            "index_condition": "variation_group_products.group_id in (12204,15883,13463,17018,13598,13149,12972,17354,12622,13437,14381,12863,14212,13663,15890,13685,13420,17283,13469)"
          }
        },
        {
          "table": {
            "table_name": "products",
            "access_type": "eq_ref",
            "possible_keys": ["PRIMARY", "status"],
            "key": "PRIMARY",
            "key_length": "3",
            "used_key_parts": ["product_id"],
            "ref": ["dev_db.variation_group_products.product_id"],
            "rows": 1,
            "filtered": 51.89157104,
            "attached_condition": "(products.amount > 0 or products.tracking = 'D') and (products.usergroup_ids = '' or find_in_set(0,products.usergroup_ids) or find_in_set(1,products.usergroup_ids)) and products.`status` = 'A'"
          }
        },
        {
          "table": {
            "table_name": "companies",
            "access_type": "eq_ref",
            "possible_keys": ["PRIMARY"],
            "key": "PRIMARY",
            "key_length": "4",
            "used_key_parts": ["company_id"],
            "ref": ["dev_db.products.company_id"],
            "rows": 1,
            "filtered": 100,
            "attached_condition": "companies.`status` = 'A'"
          }
        },
        {
          "table": {
            "table_name": "descr1",
            "access_type": "eq_ref",
            "possible_keys": ["PRIMARY", "product_id"],
            "key": "PRIMARY",
            "key_length": "11",
            "used_key_parts": ["product_id", "lang_code"],
            "ref": ["dev_db.variation_group_products.product_id", "const"],
            "rows": 1,
            "filtered": 100,
            "attached_condition": "trigcond(descr1.lang_code = 'en')"
          }
        },
        {
          "table": {
            "table_name": "cscart_product_review_prepared_data",
            "access_type": "eq_ref",
            "possible_keys": ["PRIMARY"],
            "key": "PRIMARY",
            "key_length": "7",
            "used_key_parts": ["product_id", "storefront_id"],
            "ref": ["dev_db.variation_group_products.product_id", "const"],
            "rows": 1,
            "filtered": 100
          }
        },
        {
          "table": {
            "table_name": "products_categories",
            "access_type": "ref",
            "possible_keys": ["PRIMARY", "pt"],
            "key": "pt",
            "key_length": "3",
            "used_key_parts": ["product_id"],
            "ref": ["dev_db.variation_group_products.product_id"],
            "rows": 1,
            "filtered": 100
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": ["PRIMARY", "p_category_id"],
            "key": "PRIMARY",
            "key_length": "3",
            "used_key_parts": ["category_id"],
            "ref": ["dev_db.products_categories.category_id"],
            "rows": 1,
            "filtered": 100,
            "using_index": true
          }
        }
      ]
    }
  }
}

Result

product_id amount product company_name variation_group_id product_type parent_product_id average_rating product_reviews_count
14975 999 Flower-Shaped Pendant Necklace With Hand-Embroidery, Elegant Copper Frame, A Classic Style, Large Size, Standout And Unique Accessory Tạp Hóa Ú 12204 V 6480 5.00 2
6480 999 Flower-Shaped Pendant Necklace With Hand-Embroidery, Elegant Copper Frame, A Classic Style, Large Size, Standout And Unique Accessory Tạp Hóa Ú 12204 P 0 5.00 2
17848 999 Set Of 5 Pairs Of Recycled Socks - The Minimalist, Plain Socks Easy To Match, Thick Socks, Simple Patterned Socks, High Socks For Men Remarkable - Sản phẩm chuyên về Tái Chế 12622 V 4939 5.00 1
4939 999 Set Of 5 Pairs Of Recycled Socks - The Minimalist, Plain Socks Easy To Match, Thick Socks, Simple Patterned Socks, High Socks For Men Remarkable - Sản phẩm chuyên về Tái Chế 12622 P 0 5.00 1
18679 999 Crochet Lion Rattle Toy, Green Lion Plush, Lion Plush Keychain, Woolen Toy Handmade, Lion Plush For Kids The Little Swing 12863 V 4043 5.00 1
4043 999 Crochet Lion Rattle Toy, Green Lion Plush, Lion Plush Keychain, Woolen Toy Handmade, Lion Plush For Kids The Little Swing 12863 P 0 5.00 1
18954 999 Gift Box of Scented Candles With Resin Orange-Slice Or Floral Candle Tray Onio Soapery 12972 V 3667 5.00 4
18950 999 Gift Box of Scented Candles With Resin Orange-Slice Or Floral Candle Tray Onio Soapery 12972 V 3667 5.00 4
18949 999 Gift Box of Scented Candles With Resin Orange-Slice Or Floral Candle Tray Onio Soapery 12972 V 3667 5.00 4
18948 999 Gift Box of Scented Candles With Resin Orange-Slice Or Floral Candle Tray Onio Soapery 12972 V 3667 5.00 4
18947 999 Gift Box of Scented Candles With Resin Orange-Slice Or Floral Candle Tray Onio Soapery 12972 V 3667 5.00 4
3667 999 Gift Box of Scented Candles With Resin Orange-Slice Or Floral Candle Tray Onio Soapery 12972 P 0 5.00 4
19585 999 Natural Soy Wax Scented Candle, Rainforest Limart - Zero waste 13149 V 3200 5.00 6
3200 999 Natural Soy Wax Scented Candle, Rainforest Limart - Zero waste 13149 P 0 5.00 6
21055 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21054 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21053 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21052 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21051 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21050 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21049 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21048 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
21047 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 V 2498 5.00 2
2498 999 Natural Scented Wax Sachet, Set Of 4 Calla Floral 13420 P 0 5.00 2
21072 3 Dalat Dreamers Scented Candle Iris Nguyen - Perfumery House 13437 V 2470 5.00 10
2470 3 Dalat Dreamers Scented Candle Iris Nguyen - Perfumery House 13437 P 0 5.00 10
21114 17 Diem Xua Perfume, Handmade Perfume, Oriental Floral Scent, Classic Fragrance, Luxurious, Sweet And Gentle Scent Iris Nguyen - Perfumery House 13463 V 2444 5.00 1
2444 17 Diem Xua Perfume, Handmade Perfume, Oriental Floral Scent, Classic Fragrance, Luxurious, Sweet And Gentle Scent Iris Nguyen - Perfumery House 13463 P 0 5.00 1
21120 20 Jacob Black Perfume Iris Nguyen - Perfumery House 13469 V 2438 5.00 1
2438 20 Jacob Black Perfume Iris Nguyen - Perfumery House 13469 P 0 5.00 1
21752 999 Brocade Zipper Wallet with Thai Ethnic Pattern Hoa Tiến Brocade 13598 V 2155 5.00 1
21751 999 Brocade Zipper Wallet with Thai Ethnic Pattern Hoa Tiến Brocade 13598 V 2155 5.00 1
2155 999 Brocade Zipper Wallet with Thai Ethnic Pattern Hoa Tiến Brocade 13598 P 0 5.00 1
22076 999 Teak Wood Perfume, Super Fragrant Perfume, Diverse Scent, Warm Rosewood Scent, Suitable For Dating, Gift For Lovers Saigon Elixir 13663 V 2012 5.00 3
22075 999 Teak Wood Perfume, Super Fragrant Perfume, Diverse Scent, Warm Rosewood Scent, Suitable For Dating, Gift For Lovers Saigon Elixir 13663 V 2012 5.00 3
2012 999 Teak Wood Perfume, Super Fragrant Perfume, Diverse Scent, Warm Rosewood Scent, Suitable For Dating, Gift For Lovers Saigon Elixir 13663 P 0 5.00 2
22120 999 Citrus Garden Perfume Saigon Elixir 13685 V 1990 5.00 1
22119 999 Citrus Garden Perfume Saigon Elixir 13685 V 1990 5.00 1
1990 999 Citrus Garden Perfume Saigon Elixir 13685 P 0 5.00 1
24110 999 Fly Album Handmade, High-Quality Hard Paper Material, Classic Design, Preserve Memorable Photos, Handcrafted Product Tamy Beloved 14212 V 1060 5.00 1
24109 999 Fly Album Handmade, High-Quality Hard Paper Material, Classic Design, Preserve Memorable Photos, Handcrafted Product Tamy Beloved 14212 V 1060 5.00 1
1060 999 Fly Album Handmade, High-Quality Hard Paper Material, Classic Design, Preserve Memorable Photos, Handcrafted Product Tamy Beloved 14212 P 0 5.00 1
24707 1998 Flower Clay Earrings, Unique And Eye-Catching Design, Adorable Feminine Style, Sweet Colors, Durable Terracotta Material Evian Studio 14381 P 0 5.00 2
24708 1997 Flower Clay Earrings, Unique And Eye-Catching Design, Adorable Feminine Style, Sweet Colors, Durable Terracotta Material Evian Studio 14381 V 24707 5.00 2
24709 1998 Flower Clay Earrings, Unique And Eye-Catching Design, Adorable Feminine Style, Sweet Colors, Durable Terracotta Material Evian Studio 14381 V 24707 5.00 2
36761 999 Birthday Scented Candle Gift Set ADORA 15883 P 0 5.00 1
37024 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37025 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37026 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37027 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37028 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37029 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37030 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37031 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37032 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37033 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37034 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37035 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37036 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37037 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37038 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37039 999 Birthday Scented Candle Gift Set ADORA 15883 V 36761 5.00 1
37107 999 2-sided Floral Embroidery Denim Bucket Bag From Recycled Jeans, Size 21, Recycled Material, Meticulous Craftsmanship, Sustainable Product Renew Jeans 15890 V 16847 5.00 2
37105 999 2-sided Floral Embroidery Denim Bucket Bag From Recycled Jeans, Size 21, Recycled Material, Meticulous Craftsmanship, Sustainable Product Renew Jeans 15890 V 16847 5.00 2
16847 999 2-sided Floral Embroidery Denim Bucket Bag From Recycled Jeans, Size 21, Recycled Material, Meticulous Craftsmanship, Sustainable Product Renew Jeans 15890 P 0 5.00 2
37106 999 2-sided Floral Embroidery Denim Bucket Bag From Recycled Jeans, Size 21, Recycled Material, Meticulous Craftsmanship, Sustainable Product Renew Jeans 15890 V 16847 5.00 2
47285 999 Memomate Detachable Cover Notebook Made From Washable Paper, Level Up Your Note-Taking, Eco-Friendly & Customizable, Personalized Gift KISS Notebook & Gift 17018 V 47275 5.00 3
47284 999 Memomate Detachable Cover Notebook Made From Washable Paper, Level Up Your Note-Taking, Eco-Friendly & Customizable, Personalized Gift KISS Notebook & Gift 17018 V 47275 5.00 3
47275 998 Memomate Detachable Cover Notebook Made From Washable Paper, Level Up Your Note-Taking, Eco-Friendly & Customizable, Personalized Gift KISS Notebook & Gift 17018 P 0 5.00 3
40482 998 Lacaph Tumbler, Outstanding Thermal Retention, Elegant Design with Handle, Sophisticated Color, Sustainable Lifestyle Lacàph 17283 P 0 5.00 4
49601 998 Lacaph Tumbler, Outstanding Thermal Retention, Elegant Design with Handle, Sophisticated Color, Sustainable Lifestyle Lacàph 17283 V 40482 5.00 4
49602 998 Lacaph Tumbler, Outstanding Thermal Retention, Elegant Design with Handle, Sophisticated Color, Sustainable Lifestyle Lacàph 17283 V 40482 5.00 4
49603 998 Lacaph Tumbler, Outstanding Thermal Retention, Elegant Design with Handle, Sophisticated Color, Sustainable Lifestyle Lacàph 17283 V 40482 5.00 4
50281 999 Hidden Message Scented Candle, A Heart-Melt Message In Every Flicker, Personalized Gifts, Home Decor, Gift Ideas, Scented Candle Gifts Onio Soapery 17354 V 6642 5.00 6
50282 999 Hidden Message Scented Candle, A Heart-Melt Message In Every Flicker, Personalized Gifts, Home Decor, Gift Ideas, Scented Candle Gifts Onio Soapery 17354 V 6642 5.00 6
50283 999 Hidden Message Scented Candle, A Heart-Melt Message In Every Flicker, Personalized Gifts, Home Decor, Gift Ideas, Scented Candle Gifts Onio Soapery 17354 V 6642 5.00 6
6642 999 Hidden Message Scented Candle, A Heart-Melt Message In Every Flicker, Personalized Gifts, Home Decor, Gift Ideas, Scented Candle Gifts Onio Soapery 17354 P 0 5.00 6
50279 999 Hidden Message Scented Candle, A Heart-Melt Message In Every Flicker, Personalized Gifts, Home Decor, Gift Ideas, Scented Candle Gifts Onio Soapery 17354 V 6642 5.00 6
50280 999 Hidden Message Scented Candle, A Heart-Melt Message In Every Flicker, Personalized Gifts, Home Decor, Gift Ideas, Scented Candle Gifts Onio Soapery 17354 V 6642 5.00 6