Engine Atlas

From secondary index to clustered row

secondary index · clustered row · Buffer Pool
mysql 8.4.10captured evidence
한국어
Learning guide

Question for this Lab

In a noncovering secondary-index range, which entries are read and which clustered-row lookups follow from their carried primary keys?

Execution engine: mysql 8.4.10
Who runs it?

One session executes the same SELECT in cold-page and warm-page capture variants.

What stays controlled?

The same secondary entries, selected primary keys, clustered rows, and result checksum are used.

Executed SQL
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;
What changes?

Captured page-state snapshots and counter deltas differ by variant, changing the emphasized pages.

What stays fixed?

The logical secondary-index to primary-key to clustered-row lookup and final result rows remain the same.

Predict before tracing

If the index does not contain total_cents, what is the next logical step?

If the index does not contain total_cents, what is the next logical step?

Evidence mission

Open the carried-primary-key step of the cold variant and check which primary key the secondary entry carries and why it is needed.

Where do you look?
Read the carried primary key in the index/row detail together with page state and counters in the Buffer Pool evidence.
Screen to open
Cold · carried primary key
What should you see?
Expected observation

The explicit id key part of idx_orders_customer_status_ordered_id carries the primary key, and because total_cents is absent from the entry that key becomes the PRIMARY lookup key. Page state and counters are Captured; the secondary-entry to clustered-row path stays a Model.

Evidence boundary
Captured
page-state snapshot and counter delta for the cold variant
Model
logical path from the carried primary key to the clustered row
Checkpoint · explain from evidenceCan the cold and warm views be described as a physical I/O order?Reveal answer and basis

No. The views show captured page-state snapshots and counter deltas. The secondary-entry to clustered-row path is a logical model, not a reconstruction of physical I/O order.

Evidence boundary
Captured
page-state snapshots and counter deltas
Model
logical secondary-entry to clustered-row path
Core takeaway

A noncovering index does not end at the secondary entry. Distinguish the carried primary key and base-row lookup without overstating page state as an I/O trace.

Next connection

The next Lab follows the same clustered row into the row version visible to each transaction snapshot.

Review terms
base-row lookupIntroduced in Lab 06
The logical step that uses the carried primary key to find a clustered record for columns absent from a secondary index entry.
Buffer PoolIntroduced in Lab 06
The memory cache where InnoDB keeps and reuses index and data pages.
B-treeIntroduced in Lab 02
An index structure that stores ordered keys hierarchically to support equality and range lookups.

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 and actual iterators

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

From index entry to 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 entries omitted

primary key carried into clustered lookup130460
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 and LIMIT 20 result

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