Почему вы выбрали X, а не Y
Вопрос
Why did you choose PostgreSQL over MongoDB for that project?
Почему вы выбрали PostgreSQL, а не MongoDB в том проекте?
Попробуйте сами
Ответьте вслух за 2 минуты, как на собесе. Потом сверьтесь с тезисами: что прозвучало, а что нет.
Показать ответ и разбор
Коротко
Что должно прозвучать в ответе
Называет требования и ограничения задачи
Сравнивает варианты по делу, без «модно» и «популярно»
Использует язык компромиссов: *trade-off, at the cost of*
Говорит, чем пожертвовали
Даёт условие, при котором выбрал бы другое
Что могут спросить следом
- What would make you switch to MongoDB?
- How did you handle schema changes?
Разбор
The service handled orders and payments, so we needed transactions across several tables and strong consistency. Our data was also quite relational: orders, items, customers, refunds.
We considered MongoDB because some of the team liked the flexible schema. But for us the trade-off didn't make sense: we'd get flexibility at the cost of the guarantees we really needed. PostgreSQL also gave us JSONB for the few places where the structure really varied.
The downside was that schema migrations needed more discipline, so we set up a migration tool in CI from day one.
If the main workload were huge volumes of loosely structured events, I'd probably look at a different store.
Сложные места:
- the trade-off didn't make sense: компромисс не оправдывал себя.
- from day one: с первого дня.
- If the main workload were: если бы основная нагрузка была (нереальное условие).
Ответьте сами, а не прочитайте
В тренажёре вопрос попадёт в повторения и вернётся, когда начнёт забываться. Плюс билеты с зачётом: 20 вопросов, не больше 2 ошибок.