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 (
    16334, 16335, 16348, 16349, 16350, 14140, 
    14141, 15751, 15752, 16338, 16339, 
    15753, 15754, 15755, 15756, 16340, 
    16344, 16345, 15747, 15748
  ) 
ORDER BY 
  cscart_images_links.position, 
  cscart_images_links.pair_id

Query time 0.00039

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.125080749,
    "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": 20,
              "cost": 0.06013192,
              "filtered": 100,
              "index_condition": "cscart_images_links.object_type = 'product' and cscart_images_links.`type` = 'M' and cscart_images_links.object_id in (16334,16335,16348,16349,16350,14140,14141,15751,15752,16338,16339,15753,15754,15755,15756,16340,16344,16345,15747,15748)"
            }
          }
        }
      },
      {
        "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": 20,
          "rows": 1,
          "cost": 0.0277192,
          "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": 20,
          "rows": 1,
          "cost": 0.0244424,
          "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.18.21__2___1_.png 2048 2048 N N 22208 14140 product 23988 M 0 23988
0 WhatsApp_Image_2025-04-08_at_14.18.32__5_.png 2048 1365 N N 24252 15751 product 26022 M 0 26022
0 WhatsApp_Image_2025-04-08_at_14.19.32__5_.jpeg 2048 1365 N N 25166 16334 product 26932 M 0 26932
0 WhatsApp_Image_2025-04-08_at_14.18.22__3_.png 2048 2048 N N 22210 14141 product 23989 M 1 23989
0 WhatsApp_Image_2025-04-08_at_14.18.33__2_.png 2048 2048 N N 24254 15752 product 26023 M 1 26023
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.31__4_.jpeg 2048 1365 N N 25168 16335 product 26933 M 1 26933
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.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