SELECT 
  q_images.*, 
  q_images_links.*, 
  q_common_descriptions.description AS alt, 
  q_images.image_id AS images_image_id 
FROM 
  q_images_links 
  LEFT JOIN q_images ON q_images_links.detailed_id = q_images.image_id 
  LEFT JOIN q_common_descriptions ON q_common_descriptions.object_id = q_images.image_id 
  AND q_common_descriptions.object_holder = 'images' 
  AND q_common_descriptions.lang_code = 'en' 
WHERE 
  q_images_links.object_type = 'product' 
  AND q_images_links.type = 'A' 
  AND q_images_links.object_id IN (
    '51125', '51103', '51099', '51094', 
    '51078', '40981', '40982', '40983', 
    '40984', '40985', '40986', '40987', 
    '40988', '40989', '40990', '40991', 
    '40992', '40993', '40994', '40995', 
    '40996', '40997', '40998', '40999', 
    '41000', '41001', '41002', '41003', 
    '41004', '41005'
  ) 
ORDER BY 
  q_images_links.position, 
  q_images_links.pair_id

Query time 0.00146

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "193.21"
    },
    "ordering_operation": {
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "34.00"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "q_images_links",
            "access_type": "range",
            "possible_keys": [
              "object_id"
            ],
            "key": "object_id",
            "used_key_parts": [
              "object_id",
              "object_type",
              "type"
            ],
            "key_length": "81",
            "rows_examined_per_scan": 34,
            "rows_produced_per_join": 34,
            "filtered": "100.00",
            "index_condition": "((`portal`.`q_images_links`.`object_type` = 'product') and (`portal`.`q_images_links`.`type` = 'A') and (`portal`.`q_images_links`.`object_id` in ('51125','51103','51099','51094','51078','40981','40982','40983','40984','40985','40986','40987','40988','40989','40990','40991','40992','40993','40994','40995','40996','40997','40998','40999','41000','41001','41002','41003','41004','41005')))",
            "cost_info": {
              "read_cost": "70.81",
              "eval_cost": "6.80",
              "prefix_cost": "77.61",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "pair_id",
              "object_id",
              "object_type",
              "image_id",
              "detailed_id",
              "type",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "q_images",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "image_id"
            ],
            "key_length": "4",
            "ref": [
              "portal.q_images_links.detailed_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 34,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "34.00",
              "eval_cost": "6.80",
              "prefix_cost": "118.41",
              "data_read_per_join": "26K"
            },
            "used_columns": [
              "image_id",
              "image_path",
              "image_x",
              "image_y",
              "is_high_res"
            ],
            "attached_condition": "<if>(is_not_null_compl(q_images), (`portal`.`q_images_links`.`detailed_id` = `portal`.`q_images`.`image_id`), true)"
          }
        },
        {
          "table": {
            "table_name": "q_common_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "object_id",
              "lang_code",
              "object_holder"
            ],
            "key_length": "107",
            "ref": [
              "portal.q_images.image_id",
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 34,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "34.00",
              "eval_cost": "6.80",
              "prefix_cost": "159.21",
              "data_read_per_join": "20K"
            },
            "used_columns": [
              "object_id",
              "description",
              "lang_code",
              "object_holder"
            ],
            "attached_condition": "<if>(is_not_null_compl(q_common_descriptions), (`portal`.`q_common_descriptions`.`object_id` = `portal`.`q_images`.`image_id`), true)"
          }
        }
      ]
    }
  }
}

Result

image_id image_path image_x image_y is_high_res pair_id object_id object_type detailed_id type position alt images_image_id
0 res_19a5b65503a4fd789b137994bb7e4a77_full.jpg 1000 1000 N 66408 40981 product 68359 A 1 68359
0 N15031262A_1.jpg 800 1091 N 66426 40999 product 68377 A 1 68377
0 78ddcf3d-3096-4ea0-ae53-c2ca5ea0fc1f-790x1030.jpeg_min.jpg 790 1030 N 87540 51078 product 86922 A 1 86922
0 HTB1Yj.cMVXXXXagaXXXq6xXFXXXA.jpg 790 744 N 87580 51094 product 86962 A 1 86962
0 .jpg 1500 1230 N 87588 51099 product 86970 A 1 86970
0 f12e8f8e-0d86-4f7a-bda8-34e918a1c460-790x942.jpeg_min.jpg 790 942 N 87541 51078 product 86923 A 2 86923
0 sunglasses-bluetooth-headset-wireless-sports.jpg 800 800 N 87581 51094 product 86963 A 2 86963
0 a330923d-81b4-4571-99c1-a5c8a20d3693-790x689.jpeg_min.jpg 790 689 N 87542 51078 product 86924 A 3 86924
0 03d81285-84f2-428d-b36d-f75744b2ea68-790x1218.jpeg_min.jpg 790 1218 N 87543 51078 product 86925 A 4 86925