SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  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 
FROM 
  q_products as products 
  LEFT JOIN q_product_options_inventory as inventory ON inventory.product_id = products.product_id 
  LEFT JOIN q_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  LEFT JOIN q_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN q_companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN q_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN q_categories ON q_categories.category_id = products_categories.category_id 
  AND (
    q_categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, q_categories.usergroup_ids) 
    OR FIND_IN_SET(1, q_categories.usergroup_ids)
  ) 
  AND q_categories.status IN ('A', 'H') 
  INNER JOIN q_product_variation_group_products AS variation_group_products ON variation_group_products.product_id = products.product_id 
WHERE 
  1 
  AND companies.status = 'A' 
  AND (
    CASE products.tracking WHEN 'O' THEN inventory.amount > 0 WHEN 'B' THEN products.amount > 0 ELSE 1 END
  ) 
  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) 
  AND variation_group_products.group_id IN (11, 12, 13, 14, 15, 16, 17, 3, 4, 76) 
GROUP BY 
  products.product_id 
ORDER BY 
  NULL asc

Query time 0.00283

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "151.24"
    },
    "ordering_operation": {
      "using_filesort": false,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": false,
        "nested_loop": [
          {
            "table": {
              "table_name": "inventory",
              "access_type": "system",
              "possible_keys": [
                "pc"
              ],
              "rows_examined_per_scan": 0,
              "rows_produced_per_join": 1,
              "filtered": "0.00",
              "const_row_not_found": true,
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.20",
                "prefix_cost": "0.00",
                "data_read_per_join": "976"
              },
              "used_columns": [
                "product_id",
                "amount"
              ]
            }
          },
          {
            "table": {
              "table_name": "variation_group_products",
              "access_type": "range",
              "possible_keys": [
                "PRIMARY",
                "idx_group_id"
              ],
              "key": "idx_group_id",
              "used_key_parts": [
                "group_id"
              ],
              "key_length": "4",
              "rows_examined_per_scan": 69,
              "rows_produced_per_join": 69,
              "filtered": "100.00",
              "index_condition": "(`portal`.`variation_group_products`.`group_id` in (11,12,13,14,15,16,17,3,4,76))",
              "cost_info": {
                "read_cost": "92.81",
                "eval_cost": "13.80",
                "prefix_cost": "106.61",
                "data_read_per_join": "1K"
              },
              "used_columns": [
                "product_id",
                "group_id"
              ]
            }
          },
          {
            "table": {
              "table_name": "products",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "status"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "portal.variation_group_products.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 64,
              "filtered": "93.11",
              "index_condition": "(`portal`.`variation_group_products`.`product_id` = `portal`.`products`.`product_id`)",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "12.85",
                "prefix_cost": "120.41",
                "data_read_per_join": "378K"
              },
              "used_columns": [
                "product_id",
                "product_type",
                "status",
                "company_id",
                "amount",
                "usergroup_ids",
                "tracking",
                "parent_product_id"
              ],
              "attached_condition": "((case `portal`.`products`.`tracking` when 'O' then <cache>((NULL > 0)) when 'B' then (`portal`.`products`.`amount` > 0) else 1 end) and ((`portal`.`products`.`usergroup_ids` = '') or find_in_set(0,`portal`.`products`.`usergroup_ids`) or find_in_set(1,`portal`.`products`.`usergroup_ids`)) and (`portal`.`products`.`status` = 'A'))"
            }
          },
          {
            "table": {
              "table_name": "companies",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "company_id"
              ],
              "key_length": "4",
              "ref": [
                "portal.products.company_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 6,
              "filtered": "10.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "1.28",
                "prefix_cost": "133.26",
                "data_read_per_join": "35K"
              },
              "used_columns": [
                "company_id",
                "status",
                "company"
              ],
              "attached_condition": "(`portal`.`companies`.`status` = 'A')"
            }
          },
          {
            "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": [
                "portal.products.product_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 6,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "1.28",
                "prefix_cost": "134.54",
                "data_read_per_join": "24K"
              },
              "used_columns": [
                "product_id",
                "lang_code",
                "product"
              ]
            }
          },
          {
            "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": [
                "portal.variation_group_products.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 6,
              "filtered": "99.95",
              "using_index": true,
              "cost_info": {
                "read_cost": "6.42",
                "eval_cost": "1.28",
                "prefix_cost": "142.25",
                "data_read_per_join": "154"
              },
              "used_columns": [
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "attached_condition": "((`portal`.`prices`.`lower_limit` = 1) and (`portal`.`prices`.`product_id` = `portal`.`products`.`product_id`) and (`portal`.`prices`.`usergroup_id` in (0,0,1)))"
            }
          },
          {
            "table": {
              "table_name": "products_categories",
              "access_type": "ref",
              "possible_keys": [
                "PRIMARY",
                "pt"
              ],
              "key": "pt",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "portal.variation_group_products.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 6,
              "filtered": "100.00",
              "index_condition": "(`portal`.`products_categories`.`product_id` = `portal`.`products`.`product_id`)",
              "cost_info": {
                "read_cost": "6.42",
                "eval_cost": "1.28",
                "prefix_cost": "149.96",
                "data_read_per_join": "102"
              },
              "used_columns": [
                "product_id",
                "category_id"
              ]
            }
          },
          {
            "table": {
              "table_name": "q_categories",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "c_status",
                "p_category_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "category_id"
              ],
              "key_length": "3",
              "ref": [
                "portal.products_categories.category_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 1,
              "filtered": "20.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.26",
                "prefix_cost": "151.24",
                "data_read_per_join": "3K"
              },
              "used_columns": [
                "category_id",
                "usergroup_ids",
                "status"
              ],
              "attached_condition": "(((`portal`.`q_categories`.`usergroup_ids` = '') or find_in_set(0,`portal`.`q_categories`.`usergroup_ids`) or find_in_set(1,`portal`.`q_categories`.`usergroup_ids`)) and (`portal`.`q_categories`.`status` in ('A','H')))"
            }
          }
        ]
      }
    }
  }
}

Result

product_id product company_name variation_group_id product_type parent_product_id
1737 Y&D Women's Shirt A Line Floral Patchwork Shirt Neck Leopard Decor Fashion Top Multi Color J D F General Trading LLC 3 P 0
1747 Y&D Women's Shirt A Line Floral Patchwork Shirt Neck Leopard Decor Fashion Top Multi Color J D F General Trading LLC 3 V 1737
1748 Y&D Women's Shirt A Line Floral Patchwork Shirt Neck Leopard Decor Fashion Top Multi Color J D F General Trading LLC 3 V 1737
1749 Y&D Women's Shirt A Line Floral Patchwork Shirt Neck Leopard Decor Fashion Top Multi Color J D F General Trading LLC 3 V 1737
1745 Y&D Blue Round Neck Blouse For Women J D F General Trading LLC 4 P 0
1751 Y&D Blue Round Neck Blouse For Women J D F General Trading LLC 4 V 1745
1752 Y&D Blue Round Neck Blouse For Women J D F General Trading LLC 4 V 1745
1753 Y&D Blue Round Neck Blouse For Women J D F General Trading LLC 4 V 1745
1754 Y&D Blue Round Neck Blouse For Women J D F General Trading LLC 4 V 1745
1931 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 P 0
2167 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2169 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2170 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2171 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2172 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2173 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2174 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2175 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
2176 Y&D Round Neck Solid Pattern Chiffon Material Short Sleeve Blouse For Women J D F General Trading LLC 11 V 1931
1941 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 P 0
2178 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2179 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2180 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2181 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2182 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2183 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2184 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2185 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
2186 Y&D Round Neck Solid Pattern Chiffon Short Sleeve Blouse For Women J D F General Trading LLC 12 V 1941
1951 Y&D Women's Blouse Chic Fashion V Neck Long Sleeve Flower Bow Decor Sweet Blouse White J D F General Trading LLC 13 P 0
2187 Y&D Women's Blouse Chic Fashion V Neck Long Sleeve Flower Bow Decor Sweet Blouse White J D F General Trading LLC 13 V 1951
2189 Y&D Women's Blouse Chic Fashion V Neck Long Sleeve Flower Bow Decor Sweet Blouse White J D F General Trading LLC 13 V 1951
2190 Y&D Women's Blouse Chic Fashion V Neck Long Sleeve Flower Bow Decor Sweet Blouse White J D F General Trading LLC 13 V 1951
1955 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 P 0
2191 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2192 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2193 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2194 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2195 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2196 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2197 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2198 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2199 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2200 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2201 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2203 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2204 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
2205 Y&D Women's Fashion Blouse Round Neck Sleeveless Floral Pattern Chiffon Top Multi Color J D F General Trading LLC 14 V 1955
1970 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 P 0
2206 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2208 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2209 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2210 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2211 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2212 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2213 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2214 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2215 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2216 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2217 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2218 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2219 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
2220 Y&D Women's Fashion Blouse A Line Floral Pattern Slash Neck Long Sleeve Solid Color Beach Top J D F General Trading LLC 15 V 1970
1985 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 P 0
2223 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2224 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2225 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2226 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2227 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2228 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2229 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2230 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2231 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2232 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2233 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2234 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2235 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2236 Y&D Women's Shirt Long Sleeve Plain Design J D F General Trading LLC 16 V 1985
2000 Y&D V Neck Solid Pattern Chiffon Material Full Sleeve Blouse For Women J D F General Trading LLC 17 P 0
2238 Y&D V Neck Solid Pattern Chiffon Material Full Sleeve Blouse For Women J D F General Trading LLC 17 V 2000
2239 Y&D V Neck Solid Pattern Chiffon Material Full Sleeve Blouse For Women J D F General Trading LLC 17 V 2000
2240 Y&D V Neck Solid Pattern Chiffon Material Full Sleeve Blouse For Women J D F General Trading LLC 17 V 2000
1388 Huawei Honor Band 4 Smart Wristband Bracelet Fitness Tracker For IOS/Android J D F General Trading LLC 76 P 0
8679 Huawei Honor Band 4 Smart Wristband Bracelet Fitness Tracker For IOS/Android J D F General Trading LLC 76 V 1388
8680 Huawei Honor Band 4 Smart Wristband Bracelet Fitness Tracker For IOS/Android J D F General Trading LLC 76 V 1388