Ctrl K
Backend · Mid-level · Theory

A query that used to run in milliseconds now takes seconds after the table grew to tens of millions of rows. How would you investigate, and what can you do about it?

~4 min by voice

How to approach it

This checks whether the candidate can systematically diagnose a slow query from its execution plan instead of guessing: find the cause (no index, index not used, stale statistics), design the index correctly and apply changes safely in production while accounting for their cost.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsУ нас есть таблица заказов на сотни миллионов строк и составной B-tree индекс по (user_id, created_at). Расскажите, как устроен такой индекс внутри и как база по нему выполняет запрос «последние 20 заказов пользователя». А если в запросе фильтр только по created_at — индекс поможет? Mid-levelYou have a query with window functions over a billion-row events table, and it takes forty minutes. How would you investigate, and what would you optimize? SeniorWhat are a primary key and a foreign key? And how would you model a many-to-many relationship, for example students and courses? JuniorIn which cases would you deliberately denormalize a database schema, and what's the price you pay for it? Mid-levelIn production, a query against a 200-million-row orders table suddenly started taking seconds instead of milliseconds. How would you investigate, and what can you do with indexes? Senior

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min