All jobs / Database administrator / Migrations
Database administrator interview question · 1–3 years
You have to load tens of millions of rows into a table tonight. How?
The strongest answer
Use the engine’s bulk-load path, load in committed batches, consider dropping and recreating non-critical indexes, and refresh statistics after — while watching log and disk space
Why it works
Exactly — bulk path, batches, index strategy, statistics and space are the checklist.
What a good answer covers
- Use the bulk-load path.
- Commit in batches.
- Handle indexes deliberately.
- Refresh statistics after.
Answers that fall short
- Close, but not the strongest: Insert row by row from a script; it is slower but safest
Row by row is the slowest possible path and offers no extra safety. - Weak: Load it in one giant transaction so it is all or nothing
One transaction fills the log, blocks clean-up and makes a failure at row fifty million a full rollback. - Red flag: Disable all constraints and logging permanently to make loads fast
Constraints and logging protect the data; disabling them permanently is a data-integrity gamble.
Who gets asked this
More Migrations questions
- A minor security patch for the database engine is out. How do you roll it out?
- A developer sends a schema script to run on production at 17:00 on Friday. Your response?
- How do you prove the data actually arrived intact?
- A migration adds a NOT NULL column with a default to a table with hundreds of millions of rows. Concern?
- You need a new index on a busy table. How do you build it?
- How do you rename a heavily used column without downtime?
- A backfill must touch every row of a large live table. How do you run it?
- How do you plan a major version upgrade of a production database?