Guide

Your database's performance and durability depend on the device under it. A spinning disk, a SATA SSD and an NVMe drive have very different costs. Random and sequential access differ by orders of magnitude on a disk, and less so on flash. Flash also wears out. Knowing the device explains why a workload that's fine on one machine fails on another.

Three kinds of device

DeviceRandom read latencyRandom IOPSNotes
HDD (spinning)MillisecondsAbout 150 per diskSeek and rotation dominate. Sequential is fast
SATA SSDFar lower than HDDFar higher than HDDLimited by the SATA interface
NVMe SSDLowest of the threeHighest of the threeConnects over PCIe, with many parallel queues

Random IOPS is what matters for databases. A disk at about 150 random IOPS takes roughly 6,667 seconds, under two hours, to serve 1 million random reads. Flash serves the same reads far faster. Figures vary by model, so measure your own hardware with a tool such as fio.

Walking through it: why flash is different

Flash memory can't overwrite a cell in place. It must first erase a large block, then write pages within it. Pages are small, such as 4 to 16 KB, and blocks are much larger, so the drive's flash translation layer (FTL) maps logical addresses to physical pages and moves data around.

Writes cause extra work. Say the drive must rewrite a whole block to update one page: that cost is write amplification. The ratio of flash writes to host writes tells you how much.

host writes:     256 MB
flash writes:    256 MB × 1.33 = 341 MB   (write amplification 1.33, mostly sequential)
flash writes:    256 MB × 4    = 1024 MB  (write amplification 4, random small writes)

Those two ratios are illustrative, not from a specific drive. The point is the shape. Random small writes cost more flash writes per byte, and the drive wears faster.

Endurance

Each flash cell survives a limited number of erase cycles. Vendors rate drives in terabytes written (TBW), or drive writes per day (DWPD) over a warranty period. A drive with 600 TBW written at 900 GB per day lasts about 667 days:

600 TB / 0.9 TB per day ≈ 667 days

Check the rating against your real write rate, not the average. A log-heavy database can exceed a drive's rating in months, and the failure is sudden, not gradual. Monitor the drive's wear indicator, such as SMART data, and plan replacements before it reaches the limit.

Power-loss protection

A drive has its own volatile cache, which holds writes in RAM before they reach flash. Enterprise drives include power-loss protection (PLP): capacitors that let the drive flush its cache after a power cut. Consumer drives may acknowledge a flush before the data is safe.

This ties back to fsync. A flush is only as strong as the device honoring it. For a primary database, use drives with PLP, and check that the file system and device pass flush requests through.

Important

A write-heavy database on consumer SSDs can lose committed transactions after a power cut, if the drive lies about flushes. Use enterprise drives with PLP for primary data.

Common mistakes

  • Judging a device by sequential throughput, when the workload is random small I/O.
  • Ignoring endurance on a write-heavy log or cache, and finding out at failure.
  • Assuming every SSD honors fsync.

Check yourself

  • Why does a random 4 KB write cost more flash writes than a sequential one? Answer: updating a small page may force the drive to rewrite a larger block, which raises write amplification.
  • Why does power-loss protection matter for durability? Answer: without it, the drive's volatile cache may hold acknowledged writes that a power cut erases.

Key takeaways

  • Random I/O differs most across devices, and it's what databases depend on.
  • Flash must erase before writing, so random small writes amplify wear.
  • Check endurance against your real write rate, and watch wear indicators.
  • Use drives with power-loss protection for data you can't lose.

Further learning

Next, see cloud storage and RAID for how these devices are combined and sold as volumes.