In this lesson · topic 4 of 7
Topic 4
One small record, one whole page
4 min read
A page for a record
The disk wants a whole page. The application changed one record. So the engine writes a page of 4,096 bytesmeasured to save a record of 128 bytesmeasured. If every insert wrote its own page, the engine would write 32 timesmeasured more bytes than the application sent.
The lab shows it. With the log off, each insert must put its dirty pages on disk before it can finish, and the engine writes 1.09measured pages per insert. Write amplification is 35xmeasured.
Random keys spread the damage
Where the dirty pages are matters. With ascending keys, inserts keep landing on the same few leaves. Those pages change many times and are written once, and write amplification is only 2.4xmeasured. With random keys, the lab has to write 0.28measured pages per insert even with the log on, where ascending keys write 0.04measured.
Random keys also leave leaves only 70%measured full, against 100%measured for ascending keys. That means more pages for the same data and more to read.
Predict