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 (
    '8764', '8765', '8766', '8767', '8768', 
    '8769', '8770', '8771', '8772', '8773', 
    '8774', '8776', '8788', '8825', '8826', 
    '8827', '8828', '8829', '8830', '8831', 
    '8832', '8833', '8834', '8835', '8841', 
    '8843', '8844', '8845', '8846', '8847'
  ) 
ORDER BY 
  q_images_links.position, 
  q_images_links.pair_id

Query time 0.00392

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "361.21"
    },
    "ordering_operation": {
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "69.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": 69,
            "rows_produced_per_join": 69,
            "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 ('8764','8765','8766','8767','8768','8769','8770','8771','8772','8773','8774','8776','8788','8825','8826','8827','8828','8829','8830','8831','8832','8833','8834','8835','8841','8843','8844','8845','8846','8847')))",
            "cost_info": {
              "read_cost": "112.81",
              "eval_cost": "13.80",
              "prefix_cost": "126.61",
              "data_read_per_join": "6K"
            },
            "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": 69,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "69.00",
              "eval_cost": "13.80",
              "prefix_cost": "209.41",
              "data_read_per_join": "52K"
            },
            "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": 69,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "69.00",
              "eval_cost": "13.80",
              "prefix_cost": "292.21",
              "data_read_per_join": "40K"
            },
            "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 iPhone_XR_Blk_W_Shopify_002_1500x1500_239bbb45-db61-4f48-9fa5-a83027740b46_1024x1024.jpg 1024 1024 N 18921 8764 product 20883 A 1 20883
0 iPhoneX_WaterProof_Black__Website_Scaled_002_new_1024x1024.jpg 1024 1024 N 18932 8765 product 20894 A 1 20894
0 CTF-2658679-6511901.jpg 560 560 N 18937 8766 product 20899 A 1 20899
0 2913728_iphone-xr__color_white_7011903__render8.png.560x560-w.m80.jpg 560 560 N 18940 8767 product 20902 A 1 20902
0 CTF-3164967-298601_smn0-gi.jpeg 1660 2546 N 18944 8768 product 20906 A 1 20906
0 CTF-3164967-298701.jpg 500 500 N 18952 8769 product 20914 A 1 20914
0 120-1040-Casetify-CTF40876006511801-1.jpg 2624 2624 N 18958 8770 product 20920 A 1 20920
0 4087600_iphone-x__color_silver_7111601__render8.png.560x560-w.m80_z35c-tx.jpg 560 560 N 18964 8771 product 20926 A 1 20926
0 4237970_iphone-xr__color_white_7011903__render8.png.560x560-w.m80.jpg 560 560 N 18972 8773 product 20934 A 1 20934
0 1aee5601befb94f52ae78634a9fc719b_LS_1024x.jpg 1000 1000 N 18976 8774 product 20938 A 1 20938
0 product_e_l_elementglass_25d_cart_1.jpg 1500 1174 N 19026 8776 product 20988 A 1 20988
0 Xs_Max_Charging_Black_1500x1500_4662d1b5-86e5-4a48-955d-e6970bd98575_1024x1024.jpg 1024 1024 N 19333 8825 product 21295 A 1 21295
0 XR_charging_Black_1500x1500_a8cca7de-e908-40ad-8ecc-95a064e4ee42_1024x1024.jpg 1024 1024 N 19350 8828 product 21312 A 1 21312
0 XR_charging_Black_1500x1500_a8cca7de-e908-40ad-8ecc-95a064e4ee42_1024x1024_h13p-p0.jpg 1024 1024 N 19377 8826 product 21339 A 1 21339
0 71f_gbWKmPL._SL1500_.jpg 1500 1184 N 19480 8829 product 21442 A 1 21442
0 71c8tYdM6kL._SL1500_.jpg 1500 1184 N 19489 8830 product 21451 A 1 21451
0 71yFQc0ZGvL._SL1500_.jpg 1500 1500 N 19498 8831 product 21460 A 1 21460
0 712vYQtMeiL._SL1500_.jpg 1500 1500 N 19505 8832 product 21467 A 1 21467
0 712TSVUL2nL._SL1500_.jpg 1500 1500 N 19512 8833 product 21474 A 1 21474
0 81n4fYKe0jL._SL1500__dowr-l6.jpg 1500 1500 N 19525 8834 product 21487 A 1 21487
0 CAT-IPHOX-BLK_1.jpg 1024 1024 N 19527 8835 product 21489 A 1 21489
0 7_Smoke_Phone__81901.1478251885.jpg 450 500 N 19574 8841 product 21536 A 1 21536
0 CM-CM034690_1024x.jpg 679 679 N 19595 8843 product 21557 A 1 21557
0 RS8814_cmi_iPhone_8Plus_Waterfall_Junk_Food_CM036930_1_1024x.png 1000 1000 N 19598 8844 product 21560 A 1 21560
0 Purple_P2_1024x1024.jpg 800 800 N 19601 8845 product 21563 A 1 21563
0 RS8584_cmi_PAGANI_Karat_Turquoise_CM036252_3-hpr_1024x.jpg 1024 1024 N 19603 8846 product 21565 A 1 21565
0 636689874610946171_cghw-0n.jpg 1000 1000 N 19606 8847 product 21568 A 1 21568
0 iPhone_XR_Blk_W_Shopify_003_1500x1500_6406be94-ebf5-4f12-9200-4326e0ecd69c_1024x1024.jpg 1024 1024 N 18922 8764 product 20884 A 2 20884
0 iPhoneX_WaterProof_Black__Website_Scaled_003_1024x1024.jpg 1024 1024 N 18933 8765 product 20895 A 2 20895
0 61igPIM74NL._SX679_.jpg 679 679 N 18938 8766 product 20900 A 2 20900
0 side_color_preview_7011903_white.jpg 560 560 N 18941 8767 product 20903 A 2 20903
0 4087600_iphone-x__color_silver_7111601__render8.png.560x560-w.m80.jpg 560 560 N 18959 8770 product 20921 A 2 20921
0 side_color_preview_7111601_h3ch-j9.jpg 1120 1120 N 18965 8771 product 20927 A 2 20927
0 side_color_preview_7112001_gold.jpg 560 560 N 18968 8772 product 20930 A 2 20930
0 side_color_preview_7011903_white_859y-ws.jpg 560 560 N 18973 8773 product 20935 A 2 20935
0 Xs_Max_Front_drop_Black_1500x1500_ab454193-52da-41bd-8711-06bf0a5e4613_1024x1024.jpg 1024 1024 N 19334 8825 product 21296 A 2 21296
0 XR_Front_drop_Black_1500x1500_5c8db9d1-bde6-4af4-b28b-0d1e90a87bbb_1024x1024.jpg 1024 1024 N 19351 8828 product 21313 A 2 21313
0 XR_Wireless_dock_Black_1500x1500_fa39d9d5-ab5c-4f9e-9bdb-0a018224863a_1024x1024_l9le-ck.jpg 1024 1024 N 19378 8826 product 21340 A 2 21340
0 71qHoTCCrLL._SL1500_.jpg 1500 1184 N 19481 8829 product 21443 A 2 21443
0 71e8r-2n3QL._SL1500_.jpg 1500 1184 N 19490 8830 product 21452 A 2 21452
0 710Kvf8OWOL._SL1500_.jpg 1500 1500 N 19499 8831 product 21461 A 2 21461
0 711ywlrEqXL._SL1500_.jpg 1500 1500 N 19506 8832 product 21468 A 2 21468
0 71xGHAWJw8L._SL1500_.jpg 1500 1500 N 19513 8833 product 21475 A 2 21475
0 CAT-IPHO7-WHT_LS.jpg 800 800 N 19519 8834 product 21481 A 2 21481
0 iPhoneX_WaterProof_Black__Website_Scaled_002_new_1024x1024.jpg 1024 1024 N 19528 8835 product 21490 A 2 21490
0 clic-air-tile1-v2.jpg 2670 1776 N 19575 8841 product 21537 A 2 21537
0 CM-CM034690_2_1024x.jpg 1000 1000 N 19596 8843 product 21558 A 2 21558
0 RS8816_cmi_iPhone_8Plus_Waterfall_Junk_Food_CM036930_3_1024x.png 1000 1000 N 19599 8844 product 21561 A 2 21561
0 cmi_PAGANI_Karat_Turquoise_CM036252_1_1024x.png 1000 1000 N 19604 8846 product 21566 A 2 21566
0 636689874622679988.jpg 977 794 N 19607 8847 product 21569 A 2 21569
0 iPhone_XR_Blk_W_Shopify_004_1500x1500_a7dca6af-9dc6-449f-8990-2e52b9df786b_1024x1024.jpg 1024 1024 N 18923 8764 product 20885 A 3 20885
0 iPhoneX_WaterProof_Black__Website_Scaled_004_61ab18ad-662b-4da9-ad5e-20946546e96f_1024x1024.jpg 1024 1024 N 18934 8765 product 20896 A 3 20896
0 2913728_iphone-xr__color_white_7011903__render14.png.560x560-w.m80.jpg 560 560 N 18942 8767 product 20904 A 3 20904
0 side_color_preview_7111601.jpg 1120 1120 N 18960 8770 product 20922 A 3 20922
0 4087600_iphone-x__color_silver_7111601__render14.png.560x560-w.m80_zixq-lg.jpg 560 560 N 18966 8771 product 20928 A 3 20928
0 4087600_iphone-xs-max__color_white_7112001__render14.png.560x560-w.m80.jpg 560 560 N 18969 8772 product 20931 A 3 20931
0 4237970_iphone-xr__color_white_7011903__render14.png.560x560-w.m80.jpg 560 560 N 18974 8773 product 20936 A 3 20936
0 Xs_Max_Wireless_Charging_Black_1500x1500_e9b4b286-5416-4073-b0da-eeefe7398e1e_1024x1024.jpg 1024 1024 N 19335 8825 product 21297 A 3 21297
0 XR_Wireless_dock_Black_1500x1500_fa39d9d5-ab5c-4f9e-9bdb-0a018224863a_1024x1024.jpg 1024 1024 N 19352 8828 product 21314 A 3 21314
0 iPhone_X_6.1_Black_1500x1500_08_1024x1024_srcc-ft.jpg 1024 1024 N 19379 8826 product 21341 A 3 21341
0 71K2ROgQn3L._SL1500_.jpg 1500 1500 N 19482 8829 product 21444 A 3 21444
0 61yI3pQ-gsL._SL1500_.jpg 1500 1184 N 19491 8830 product 21453 A 3 21453
0 716_ooc1GJL._SL1500_.jpg 1500 1500 N 19500 8831 product 21462 A 3 21462
0 71cYjM1bNCL._SL1500_.jpg 1500 1500 N 19507 8832 product 21469 A 3 21469
0 71aJ6UNiNcL._SL1500_.jpg 1500 1500 N 19514 8833 product 21476 A 3 21476
0 71xGHAWJw8L._SL1500__b8jj-rm.jpg 1500 1500 N 19521 8834 product 21483 A 3 21483
0 iPhoneX_WaterProof_Black__Website_Scaled_003_1024x1024.jpg 1024 1024 N 19529 8835 product 21491 A 3 21491
0 636689874626899146.jpg 409 933 N 19608 8847 product 21570 A 3 21570
0 iPhone_XR_Blk_W_Shopify_005_1500x1500_5b1c16b0-7c56-4fcb-84ee-2b0e75359585_1024x1024.jpg 1024 1024 N 18924 8764 product 20886 A 4 20886
0 iPhoneX_WaterProof_Black__Website_Scaled_EP_1024x1024_b0c42967-0307-4564-b1ff-2f74083f632e_1024x1024.jpg 1024 1024 N 18935 8765 product 20897 A 4 20897
0 4087600_iphone-x__color_silver_7111601__render14.png.560x560-w.m80.jpg 560 560 N 18961 8770 product 20923 A 4 20923
0 4087600_iphone-xs-max__color_white_7112001__render8.png.560x560-w.m80.jpg 560 560 N 18970 8772 product 20932 A 4 20932
0 iPhone_X_6.5_Black_1500x1500_04_1024x1024.jpg 1024 1024 N 19336 8825 product 21298 A 4 21298
0 iPhone_X_6.1_Black_1500x1500_04_1024x1024.jpg 1024 1024 N 19353 8828 product 21315 A 4 21315
0 71sGH0jTCSL._SL1500_.jpg 1500 1184 N 19483 8829 product 21445 A 4 21445
0 71NKurRs_CL._SL1500_.jpg 1500 1184 N 19492 8830 product 21454 A 4 21454
0 61ylPRSJRwL._SL1500_.jpg 1500 1500 N 19501 8831 product 21463 A 4 21463
0 71wPwlf6PeL._SL1500_.jpg 1500 1500 N 19508 8832 product 21470 A 4 21470
0 91jL9H3p5mL._SL1500_.jpg 1500 1500 N 19515 8833 product 21477 A 4 21477
0 71aJ6UNiNcL._SL1500__5tyl-yy.jpg 1500 1500 N 19522 8834 product 21484 A 4 21484
0 iPhoneX_WaterProof_Black__Website_Scaled_004_61ab18ad-662b-4da9-ad5e-20946546e96f_1024x1024.jpg 1024 1024 N 19530 8835 product 21492 A 4 21492
0 iPhone_XR_Blk_W_Shopify_006_1500x1500_277f66ba-5c61-4bff-baf0-0df930d842c1_1024x1024.jpg 1024 1024 N 18925 8764 product 20887 A 5 20887
0 iPhoneX_WaterProof_Black__Website_Scaled_006_1024x1024.jpg 1024 1024 N 18936 8765 product 20898 A 5 20898
0 iPhone_X_6.5_Black_1500x1500_05_1024x1024.jpg 1024 1024 N 19337 8825 product 21299 A 5 21299
0 iPhone_X_6.1_Black_1500x1500_05_1024x1024.jpg 1024 1024 N 19354 8828 product 21316 A 5 21316
0 71kw068ButL._SL1500_.jpg 1500 1184 N 19484 8829 product 21446 A 5 21446
0 71oc_wYZSAL._SL1500_.jpg 1500 1184 N 19493 8830 product 21455 A 5 21455
0 81PclxZdw2L._SL1500_.jpg 1500 1184 N 19502 8831 product 21464 A 5 21464
0 81PclxZdw2L._SL1500__s25m-bh.jpg 1500 1184 N 19509 8832 product 21471 A 5 21471
0 71ifKsWWq3L._SL1023_.jpg 1023 808 N 19516 8833 product 21478 A 5 21478
0 91jL9H3p5mL._SL1500__5zte-1a.jpg 1500 1500 N 19523 8834 product 21485 A 5 21485
0 iPhoneX_WaterProof_Black__Website_Scaled_005_1024x1024.jpg 1024 1024 N 19531 8835 product 21493 A 5 21493
0 iPhone_XR_Blk_W_Shopify_007_1500x1500_1fe16597-f15f-4f24-a813-5b4dae4d6cdd_1024x1024.jpg 1024 1024 N 18926 8764 product 20888 A 6 20888
0 iPhone_X_6.5_Black_1500x1500_06_1024x1024.jpg 1024 1024 N 19338 8825 product 21300 A 6 21300
0 iPhone_X_6.1_Black_1500x1500_06_1024x1024.jpg 1024 1024 N 19355 8828 product 21317 A 6 21317
0 61-angY8dyL._SL1500_.jpg 1500 1184 N 19485 8829 product 21447 A 6 21447
0 71Vfk7kqkEL._SL1500_.jpg 1500 1184 N 19494 8830 product 21456 A 6 21456
0 41VG5e4KwOL.jpg 500 500 N 19503 8831 product 21465 A 6 21465
0 61V0R8b2TBL.jpg 500 500 N 19510 8832 product 21472 A 6 21472
0 81n4fYKe0jL._SL1500_.jpg 1500 1500 N 19517 8833 product 21479 A 6 21479
0 71ifKsWWq3L._SL1023__gsvm-pf.jpg 1023 808 N 19524 8834 product 21486 A 6 21486
0 iPhoneX_WaterProof_Black__Website_Scaled_008_1024x1024.jpg 1024 1024 N 19532 8835 product 21494 A 6 21494
0 iPhone_XR_Blk_W_Shopify_008_1500x1500_a30ec464-063d-4520-8851-ce2670fc4e92_1024x1024.jpg 1024 1024 N 18927 8764 product 20889 A 7 20889
0 iPhone_X_6.5_Black_1500x1500_07_1024x1024.jpg 1024 1024 N 19339 8825 product 21301 A 7 21301
0 iPhone_X_6.1_Black_1500x1500_07_1024x1024.jpg 1024 1024 N 19356 8828 product 21318 A 7 21318
0 71tJzMvACSL._SL1500_.jpg 1500 1184 N 19486 8829 product 21448 A 7 21448
0 713vOb2rY8L._SL1500_.jpg 1500 1500 N 19495 8830 product 21457 A 7 21457
0 81oJhefuSwL._SL1500_.jpg 1500 1500 N 19518 8833 product 21480 A 7 21480
0 81oJhefuSwL._SL1500__bnkf-ub.jpg 1500 1500 N 19526 8834 product 21488 A 7 21488
0 iPhoneX_WaterProof_Black__Website_Scaled_007_1024x1024.jpg 1024 1024 N 19533 8835 product 21495 A 7 21495
0 iPhone_XR_Blk_W_Shopify_009_1500x1500_6289687a-f5cb-4ff8-9cce-549369316667_1024x1024.jpg 1024 1024 N 18928 8764 product 20890 A 8 20890
0 iPhone_X_6.5_Black_1500x1500_08_1024x1024.jpg 1024 1024 N 19340 8825 product 21302 A 8 21302
0 iPhone_X_6.1_Black_1500x1500_08_1024x1024.jpg 1024 1024 N 19357 8828 product 21319 A 8 21319
0 71ppahrFZwL._SL1500_.jpg 1500 1500 N 19487 8829 product 21449 A 8 21449
0 61Fb5BHNOLL._SL1500_.jpg 1500 1500 N 19496 8830 product 21458 A 8 21458
0 iPhone_XR_Blk_W_Shopify_010_1500x1500_1548bfd3-28a3-4d56-aa5c-02ba08188e89_1024x1024.jpg 1024 1024 N 18929 8764 product 20891 A 9 20891
0 iPhone_Xs_Blk_W_Shopify_011_1500x1500_206496dc-40bf-44a5-b690-3ee61df0cd81_1024x1024.jpg 1024 1024 N 18930 8764 product 20892 A 10 20892
0 iPhone_X_Impact_case_front_1500x1500_GClear_image1.2_1024x1024.jpg 1024 1024 N 19359 8827 product 21321 A 10 21321
0 iPhone_X_Impact_case_front_1500x1500_Clear_image2_1024x1024.jpg 1024 1024 N 19360 8827 product 21322 A 11 21322
0 iPhone_X_Impact_case_front_1500x1500_Clear_image3_1024x1024.jpg 1024 1024 N 19361 8827 product 21323 A 12 21323
0 iPhone_X_Impact_case_front_1500x1500_GClear_image4_1024x1024.jpg 1024 1024 N 19362 8827 product 21324 A 13 21324
0 iPhone_X_Impact_case_front_1500x1500_GClear_image8_1024x1024.jpg 1024 1024 N 19363 8827 product 21325 A 14 21325
0 iPhone_X_Impact_case_front_1500x1500_GClear_image7_1024x1024.jpg 1024 1024 N 19364 8827 product 21326 A 15 21326
0 iPhone_X_Impact_case_front_1500x1500_GClear_image6_1024x1024.jpg 1024 1024 N 19365 8827 product 21327 A 16 21327
0 iPhone_X_Impact_case_front_1500x1500_GClear_image9_1024x1024.jpg 1024 1024 N 19366 8827 product 21328 A 17 21328