Tinker Databases & indexes

by Kondasamy Jayaraman · drawn with Colorfigures by April Zhu

No order written yet.0 pages read · 0 rows read

Chapter 3 of 7

Every write pays

The order lookup is fast now. The team wants indexes on customer and date too, then the Monday rush brings new orders.

This chapter: What does each index cost when a new order is written?

About this chapter

You will learn

  • An insert updates every index
  • Full leaves split in two
  • Why unused indexes are pure cost

Words you’ll meet

Insert
Writing a new row into a table.
Page split
When a full page gets a new key, it splits in two and its parent gains an entry.

Step 1 of 4

A new order is an : one row written to the table’s last page. With no index, that is all.

Write a new order.

The SQL
INSERT INTO orders (id, customer, day, status)
VALUES (10001, 398, DATE '2026-01-01' + 296, 'open');