Databases 8 min read

[Interview Question] How to Add an Index to a Tens‑Millions‑Row Table Without Downtime

The discussion explores practical strategies for adding an index to a MySQL table containing tens of millions of rows without stopping service, covering intermediate tables, double‑write syncing, rename operations, traffic considerations, lock types, and tooling such as Percona.

Nightwalker Tech
Nightwalker Tech
Nightwalker Tech
[Interview Question] How to Add an Index to a Tens‑Millions‑Row Table Without Downtime

The thread centers on an interview question asking how to add an index to a table with tens of millions of rows without incurring downtime, prompting participants to share real‑world tactics.

Common solutions include creating a temporary intermediate table, building the index on it, and synchronizing data between the original and the new table using double‑write; once synchronized, the original table can be switched out, often via a rename operation, though this may still require a brief pause for writes.

Participants stress the importance of understanding the workload—traffic peaks, transaction volume, and machine load—and suggest using read‑locks, degradation strategies, or tools like Percona's online schema change utilities to minimize impact, while also noting that index type (clustered vs. non‑clustered) and lock granularity (row vs. table) affect feasibility.

The page also contains unrelated sections such as a daily joke, classic quotes, and a brief side discussion on language inheritance, which are not directly related to the technical content.

IndexingMySQLLarge TablesPerconadatabase migrationzero downtime
Nightwalker Tech
Written by

Nightwalker Tech

[Nightwalker Tech] is the tech sharing channel of "Nightwalker", focusing on AI and large model technologies, internet architecture design, high‑performance networking, and server‑side development (Golang, Python, Rust, PHP, C/C++).

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.