SELECT 
  b.variant_name, 
  a.* 
FROM 
  cscart_product_option_variants AS a 
  LEFT JOIN cscart_product_option_variants_descriptions AS b ON b.variant_id = a.variant_id 
  AND b.lang_code = 'vi' 
WHERE 
  1 
  AND a.option_id IN (
    1226, 844, 845, 1476, 601, 194, 886, 887, 
    187, 1595, 1434
  ) 
  AND a.status = 'A' 
ORDER BY 
  a.position, 
  a.variant_id

Query time 0.02446

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "read_sorted_file": {
          "filesort": {
            "sort_key": "a.position, a.variant_id",
            "table": {
              "table_name": "a",
              "access_type": "range",
              "possible_keys": ["status", "option_id", "option_id_2"],
              "key": "option_id",
              "key_length": "6",
              "used_key_parts": ["option_id", "status"],
              "rows": 27,
              "filtered": 100,
              "index_condition": "a.option_id in (1226,844,845,1476,601,194,886,887,187,1595,1434) and a.`status` = 'A'"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "b",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["variant_id", "lang_code"],
          "ref": ["dev_db.a.variant_id", "const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(b.lang_code = 'vi')"
        }
      }
    ]
  }
}

Result

variant_name variant_id option_id position modifier modifier_type weight_modifier weight_modifier_type point_modifier point_modifier_type status
Hộp quà kèm diêm và thiệp 232 187 0 25000.000 A 0.000 A 0.000 A A
A01 - Đen 904 601 0 0.000 A 0.000 A 0.000 A A
A02 - Nâu cánh gián 905 601 0 0.000 A 0.000 A 0.000 A A
A03 - Nâu socola 910 601 0 0.000 A 0.000 A 0.000 A A
A04 - Nâu đậm 911 601 0 0.000 A 0.000 A 0.000 A A
Phối màu 912 601 0 0.000 A 0.000 A 0.000 A A
3183 1226 0 0.000 A 0.000 A 0.000 A A
3821 1434 0 0.000 A 0.000 A 0.000 A A
3880 1476 0 0.000 A 0.000 A 0.000 A A
4152 1595 0 0.000 A 0.000 A 0.000 A A
150g 1941 844 1 0.000 A 0.000 A 0.000 A A
Nguyên hạt 1943 845 1 0.000 A 0.000 A 0.000 A A
500gr 2074 886 1 60800.000 A 0.000 A 0.000 A A
Dạng bột 2076 887 1 0.000 A 0.000 A 0.000 A A
3182 1226 1 0.000 A 0.000 A 0.000 A A
3820 1434 1 0.000 A 0.000 A 0.000 A A
3879 1476 1 0.000 A 0.000 A 0.000 A A
4151 1595 1 0.000 A 0.000 A 0.000 A A
200g 1942 844 2 120000.000 A 0.000 A 0.000 A A
Mịn (Espresso, Moka pot) 1944 845 2 0.000 A 0.000 A 0.000 A A
340gr 2075 886 2 0.000 A 0.000 A 0.000 A A
Dạng hạt 2077 887 2 0.000 A 0.000 A 0.000 A A
Mịn vừa (Aeropress, Phin) 1945 845 3 0.000 A 0.000 A 0.000 A A
Vừa (Pour over, Drip) 1946 845 4 0.000 A 0.000 A 0.000 A A
Thô (Cold brew, French drip) 1947 845 5 0.000 A 0.000 A 0.000 A A
Họa tiết 239 194 10 500000.000 A 0.000 A 0.000 A A
Khắc tên 1102 194 20 500000.000 A 0.000 A 0.000 A A