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 (
    1292, 1155, 1153, 681, 680, 425, 1270, 
    1151, 712, 1154, 709, 710, 711
  ) 
  AND a.status = 'A' 
ORDER BY 
  a.position, 
  a.variant_id

Query time 0.00348

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": 39,
              "filtered": 100,
              "index_condition": "a.option_id in (1292,1155,1153,681,680,425,1270,1151,712,1154,709,710,711) 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
Gói qùa hộp giấy cứng 518 425 0 25000.000 A 0.000 A 0.000 A A
Bệt 1416 680 1 0.000 A 0.000 A 0.000 A A
Rùa da 1510 709 1 0.000 A 0.000 A 0.000 A A
Rùa da 1514 710 1 0.000 A 0.000 A 0.000 A A
Rùa da 1518 711 1 0.000 A 0.000 A 0.000 A A
1 đôi 1522 712 1 0.000 A 0.000 A 0.000 A A
Nâu 2796 1151 1 0.000 A 0.000 A 0.000 A A
Đen 2800 1153 1 0.000 A 0.000 A 0.000 A A
Trắng 2803 1154 1 0.000 A 0.000 A 0.000 A A
Nâu 2805 1155 1 0.000 A 0.000 A 0.000 A A
Trắng 3351 1270 1 0.000 A 0.000 A 0.000 A A
Size M 3467 1292 1 0.000 A 0.000 A 0.000 A A
3cm 1417 680 2 0.000 A 0.000 A 0.000 A A
Gấu ngựa 1511 709 2 0.000 A 0.000 A 0.000 A A
Gấu ngựa 1515 710 2 0.000 A 0.000 A 0.000 A A
Gấu ngựa 1519 711 2 0.000 A 0.000 A 0.000 A A
Set 3 đôi 1523 712 2 157000.000 A 0.000 A 0.000 A A
Đen 2797 1151 2 0.000 A 0.000 A 0.000 A A
Nâu 2801 1153 2 0.000 A 0.000 A 0.000 A A
Đen 2804 1154 2 0.000 A 0.000 A 0.000 A A
Đen 2806 1155 2 0.000 A 0.000 A 0.000 A A
Đen 3352 1270 2 0.000 A 0.000 A 0.000 A A
Size L 3468 1292 2 0.000 A 0.000 A 0.000 A A
5cm 1418 680 3 0.000 A 0.000 A 0.000 A A
Sếu đầu đỏ 1512 709 3 0.000 A 0.000 A 0.000 A A
Sếu đầu đỏ 1516 710 3 0.000 A 0.000 A 0.000 A A
Sếu đầu đỏ 1520 711 3 0.000 A 0.000 A 0.000 A A
Set 4 đôi 1524 712 3 235000.000 A 0.000 A 0.000 A A
Trắng 2802 1153 3 0.000 A 0.000 A 0.000 A A
Xanh đen 3353 1270 3 0.000 A 0.000 A 0.000 A A
Size XL 3469 1292 3 0.000 A 0.000 A 0.000 A A
Logo mây 1513 709 4 0.000 A 0.000 A 0.000 A A
Logo mây 1517 710 4 0.000 A 0.000 A 0.000 A A
Logo mây 1521 711 4 0.000 A 0.000 A 0.000 A A
Hồng 3354 1270 4 0.000 A 0.000 A 0.000 A A
Xám 3355 1270 5 0.000 A 0.000 A 0.000 A A
Size 37 1419 681 10 0.000 A 0.000 A 0.000 A A
Size 38 1420 681 20 0.000 A 0.000 A 0.000 A A
Size 39 1421 681 30 0.000 A 0.000 A 0.000 A A