Engine Atlas

Secondary index에서 clustered row까지

secondary index · clustered row · Buffer Pool
mysql 8.4.10captured evidence
English
01 · SOURCE

Exact SQL

5 active fragmentsMySQLrange · non-covering · ORDER BY · LIMIT 20
SELECT id, customer_id, status, ordered_at, total_cents
FROM orders
WHERE customer_id = 412
  AND status = 'PAID'
  AND ordered_at >= '2025-01-01 00:00:00'
ORDER BY ordered_at DESC, id DESC
LIMIT 20;
  1. LimitLIMIT 20
  2. range scansecondary index
02 · FLOW

Native plan과 actual iterator

01 / 17
Active native excerpt2
limitTREE line 1

-> Limit: 20 row(s) (cost=14.2 rows=20)

index-range-scanTREE line 2

-> Index range scan on orders using idx_orders_customer_status_ordered_id over (customer_id = 412 AND status = 'PAID' AND ordered_at <= '2025-01-01 00:00:00'), with index condition: ((orders.`status` = 'PAID') and (orders.customer_id = 412) and (orders.ordered_at >= TIMESTAMP'2025-01-01 00:00:00')) (cost=14.2 rows=31)

DATA PATH

Index entry에서 clustered row까지

Model
WHERE range

Matching secondary entries

Derived · fixture
customer_idstatusordered_atid · primary key
412PAID2026-06-24 23:20:00130460
412PAID2026-06-17 20:40:00129436
412PAID2026-05-20 10:00:00125340

31 total · 28 개 entry 생략

clustered lookup에 전달되는 primary key130460
total_cents absent from secondary entry
PRIMARY

Exact clustered row

Derived · fixture
id
130460
customer_id
412
status
PAID
ordered_at
2026-06-24 23:20:00
total_cents
113740

ORDER BY와 LIMIT 20 결과

Captured
idcustomer_idstatusordered_attotal_cents
130460412PAID2026-06-24 23:20:00113740
129436412PAID2026-06-17 20:40:004684
125340412PAID2026-05-20 10:00:0068460
124316412PAID2026-05-13 07:20:00209404
120220412PAID2026-04-14 20:40:0023180
119196412PAID2026-04-07 18:00:00164124
115100412PAID2026-03-10 07:20:00227900
114076412PAID2026-03-03 04:40:00118844
109980412PAID2026-02-02 18:00:00182620
108956412PAID2026-01-26 15:20:0073564
104860412PAID2025-12-29 04:40:00137340
103836412PAID2025-12-22 02:00:0028284
99740412PAID2025-11-23 15:20:0092060
98716412PAID2025-11-16 12:40:00233004
94620412PAID2025-10-19 02:00:0046780
93596412PAID2025-10-11 23:20:00187724
89500412PAID2025-09-13 12:40:001500
88476412PAID2025-09-06 10:00:00142444
84380412PAID2025-08-08 23:20:00206220
83356412PAID2025-08-01 20:40:0097164
sha256 · f3b6a116a0d644412cd60167a96e4e8d628adbe75106f53d78c3893fef401a8b
01 / 17