SELECT 
  cscart_images.*, 
  cscart_images_links.*, 
  cscart_common_descriptions.description AS alt, 
  cscart_images.image_id AS images_image_id 
FROM 
  cscart_images_links 
  LEFT JOIN cscart_images ON cscart_images_links.detailed_id = cscart_images.image_id 
  LEFT JOIN cscart_common_descriptions ON cscart_common_descriptions.object_id = cscart_images.image_id 
  AND cscart_common_descriptions.object_holder = 'images' 
  AND cscart_common_descriptions.lang_code = 'en' 
WHERE 
  cscart_images_links.object_type = 'product' 
  AND cscart_images_links.type = 'M' 
  AND cscart_images_links.object_id IN (
    16348, 16349, 16350, 16338, 16339, 15753, 
    15754, 15755, 15756, 16340, 16344, 
    16345, 15747, 15748, 16351, 16352, 
    16353, 15734, 15735, 15736, 15737, 
    15738, 15739, 15740, 15168, 15169
  ) 
ORDER BY 
  cscart_images_links.position, 
  cscart_images_links.pair_id

Query time 0.00038

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.150596654,
    "nested_loop": [
      {
        "read_sorted_file": {
          "filesort": {
            "sort_key": "cscart_images_links.position, cscart_images_links.pair_id",
            "table": {
              "table_name": "cscart_images_links",
              "access_type": "range",
              "possible_keys": ["object_id"],
              "key": "object_id",
              "key_length": "81",
              "used_key_parts": ["object_id", "object_type", "type"],
              "loops": 1,
              "rows": 26,
              "cost": 0.07105288,
              "filtered": 100,
              "index_condition": "cscart_images_links.object_type = 'product' and cscart_images_links.`type` = 'M' and cscart_images_links.object_id in (16348,16349,16350,16338,16339,15753,15754,15755,15756,16340,16344,16345,15747,15748,16351,16352,16353,15734,15735,15736,15737,15738,15739,15740,15168,15169)"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "cscart_images",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "4",
          "used_key_parts": ["image_id"],
          "ref": ["u508912950_dev_2025.cscart_images_links.detailed_id"],
          "loops": 26,
          "rows": 1,
          "cost": 0.03308584,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "cscart_common_descriptions",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "108",
          "used_key_parts": ["object_id", "lang_code", "object_holder"],
          "ref": ["u508912950_dev_2025.cscart_images.image_id", "const", "const"],
          "loops": 26,
          "rows": 1,
          "cost": 0.02980904,
          "filtered": 100,
          "attached_condition": "trigcond(cscart_common_descriptions.object_holder = 'images' and cscart_common_descriptions.lang_code = 'en' and trigcond(cscart_images.image_id is not null))"
        }
      }
    ]
  }
}

Result

image_id image_path image_x image_y is_high_res transparent pair_id object_id object_type detailed_id type position alt images_image_id
0 WhatsApp_Image_2025-04-08_at_14.20.23__1__wuj7-u5.png 2048 1365 N N 23347 15168 product 25126 M 0 25126
0 WhatsApp_Image_2025-04-08_at_14.18.28__5_.jpeg 2048 1365 N N 24226 15738 product 26000 M 0 26000
0 WhatsApp_Image_2025-04-08_at_14.20.23__2_.png 2048 1365 N N 23349 15169 product 25127 M 1 25127
0 WhatsApp_Image_2025-04-08_at_14.18.30__4_.jpeg 2048 1365 N N 24229 15734 product 26001 M 1 26001
0 WhatsApp_Image_2025-04-08_at_14.18.29__4_.jpeg 2048 1365 N N 24230 15735 product 26002 M 1 26002
0 WhatsApp_Image_2025-04-08_at_14.18.28__6_.jpeg 2048 1365 N N 24231 15736 product 26003 M 1 26003
0 WhatsApp_Image_2025-04-08_at_14.18.29__7_.jpeg 2048 1365 N N 24232 15737 product 26004 M 1 26004
0 WhatsApp_Image_2025-04-08_at_14.18.29__6_.jpeg 2048 1365 N N 24233 15739 product 26005 M 1 26005
0 WhatsApp_Image_2025-04-08_at_14.18.29__5_.jpeg 2048 1365 N N 24234 15740 product 26006 M 1 26006
0 WhatsApp_Image_2025-04-08_at_14.19.33__3_.jpeg 2048 1365 N N 24256 15753 product 26025 M 1 26025
0 WhatsApp_Image_2025-04-08_at_14.19.32__4_.jpeg 2048 1365 N N 24260 15754 product 26026 M 2 26026
0 WhatsApp_Image_2025-04-08_at_14.19.34__3_.jpeg 2048 1365 N N 24261 15755 product 26027 M 2 26027
0 WhatsApp_Image_2025-04-08_at_14.19.31__3_.jpeg 2048 1365 N N 24262 15756 product 26028 M 2 26028
0 WhatsApp_Image_2025-04-08_at_14.18.31__6_.jpeg 2048 1365 N N 24245 15747 product 26016 M 3 26016
0 WhatsApp_Image_2025-04-08_at_14.19.33__4_.jpeg 2048 1365 N N 25174 16338 product 26939 M 3 26939
0 WhatsApp_Image_2025-04-08_at_14.19.37__4_.jpeg 2048 1365 N N 25543 16348 product 27305 M 3 27305
0 WhatsApp_Image_2025-04-08_at_14.18.31__5_.jpeg 2048 1365 N N 24247 15748 product 26017 M 4 26017
0 WhatsApp_Image_2025-04-08_at_14.19.33__5_.jpeg 2048 1365 N N 25176 16339 product 26940 M 4 26940
0 WhatsApp_Image_2025-04-08_at_14.19.35__3_.jpeg 2048 1365 N N 25409 16340 product 27173 M 4 27173
0 WhatsApp_Image_2025-04-08_at_14.19.37__3_.jpeg 2048 1365 N N 25546 16349 product 27306 M 4 27306
0 WhatsApp_Image_2025-04-08_at_14.19.36__4_.jpeg 2048 1365 N N 25547 16350 product 27307 M 4 27307
0 WhatsApp_Image_2025-04-08_at_14.19.36__5_.jpeg 2048 1365 N N 25549 16351 product 27309 M 4 27309
0 WhatsApp_Image_2025-04-08_at_14.19.34__4_.jpeg 2048 1365 N N 25536 16344 product 27298 M 5 27298
0 WhatsApp_Image_2025-04-08_at_14.19.34__5_.jpeg 2048 1365 N N 25537 16345 product 27299 M 5 27299
0 WhatsApp_Image_2025-04-08_at_14.19.38__5_.jpeg 2048 1365 N N 25552 16352 product 27310 M 5 27310
0 WhatsApp_Image_2025-04-08_at_14.19.37__5_.jpeg 2048 1365 N N 25553 16353 product 27311 M 5 27311