VWhen would you choose a relational database over a document store?
Pytanie rekruteraBazy danych
Rozmowy o bazach danych zwykle idą od podstaw (SQL, złączenia, indeksy) do transakcji i wydajności. W części ustnej kluczową umiejętnością jest proste wyjaśnienie technicznej idei, bez rysowania jej na tablicy.
Używaj kontrastu, aby odpowiedzi były jasne: „z indeksem baza robi X, bez niego robi Y”. Kontrast słuchacz łatwo zapamiętuje, a tobie łatwo go powiedzieć po angielsku.
- ✓Słowa → zwroty → zdania → mówienie
- ✓Sens odpowiedzi
- ✓Język
Częste pytania i przykładowe odpowiedzi
When would you choose a relational database over a document store?
Kiedy wybierzesz relacyjną bazę danych zamiast bazy dokumentowej?
Co chce usłyszeć rekruter. Konkretne kryteria i świadomość, że wiele systemów używa obu rozwiązań.
Przykładowa odpowiedź po angielsku do ćwiczenia na głosI choose a relational database when the data has a clear structure and relationships, and when I need strong consistency and transactions, for example orders and payments. SQL also gives me flexible queries, joins and constraints that protect the data. A document store is a good choice when the data is naturally one nested document, the schema changes often, or I need to scale writes horizontally and I can accept simpler queries. In many projects I use both: a relational database as the source of truth and a document store or a search engine for specific reads.
How does an index work, and what does it cost?
Jak działa indeks i ile kosztuje?
Co chce usłyszeć rekruter. Struktura, korzyść, koszt dla zapisu i kolejność kolumn w indeksie złożonym.
Przykładowa odpowiedź po angielsku do ćwiczenia na głosAn index is an additional data structure, usually a B-tree, that lets the database find rows without scanning the whole table. It is like the index at the back of a book. It speeds up reads, sorting and joins, but it costs disk space and slows down writes, because every insert and update must also update the index. For a composite index, the order of columns matters, because the database can use only the leftmost part. I create indexes for the real queries, check them with EXPLAIN and remove the ones that are not used.
What does ACID mean?
Co oznacza ACID?
Co chce usłyszeć rekruter. Cztery właściwości wyjaśnione na jednym przykładzie.
Przykładowa odpowiedź po angielsku do ćwiczenia na głosACID describes the guarantees of a transaction. Atomicity means that a transaction is all or nothing. Consistency means that it moves the database from one valid state to another, so constraints are respected. Isolation means that concurrent transactions do not see each other's unfinished work, to the degree defined by the isolation level. Durability means that once a transaction is committed, it survives a crash, usually because it is written to a log on disk. A classic example is a money transfer: both the withdrawal and the deposit happen, or neither does.
A query is slow in production. What do you do?
Zapytanie działa wolno na produkcji. Co robisz?
Co chce usłyszeć rekruter. Metoda: zmierzyć, przeczytać plan, naprawić, zweryfikować.
Przykładowa odpowiedź po angielsku do ćwiczenia na głosFirst I measure, I do not guess. I find the exact query, from the slow query log or monitoring, and run EXPLAIN to see the plan. I look for a full table scan, a missing or unused index, a bad join order or outdated statistics. Often the fix is a better index or a rewritten query. In applications with an ORM, I also check for the N+1 problem, where one request creates hundreds of small queries. After the change, I compare timings with real data volumes, because a query can be fast on a small test database and slow in production.
What are isolation levels, and what problems do they prevent?
Czym są poziomy izolacji i jakim problemom zapobiegają?
Co chce usłyszeć rekruter. Brudne odczyty, odczyty niepowtarzalne i fantomy oraz kompromis ze współbieżnością.
Przykładowa odpowiedź po angielsku do ćwiczenia na głosIsolation levels control what a transaction can see from other concurrent transactions. Read committed prevents dirty reads, so you see only committed data. Repeatable read also prevents non-repeatable reads: the same row gives the same value inside one transaction. Serializable also prevents phantom reads, where a repeated query returns new rows, and it behaves as if the transactions ran one by one. Higher levels give more safety but lower concurrency. Many databases, such as PostgreSQL, use read committed by default, and I raise the level only for operations where the anomaly would be a real business problem.
Jak wymawiać kluczowe terminy
- SQL
- es-kju-EL albo „SI-kwel”
- schema
- SKI-ma
- query
- KŁIR-i
- ACID
- ES-id
- normalisation
- nor-ma-laj-ZEJ-szn
- transaction
- tran-ZEK-szn
Przydatne zwroty do odpowiedzi
- The database has to scan the whole table.Baza danych musi przeskanować całą tabelę.
- It trades read speed for write cost.To wymiana szybkości odczytu na koszt zapisu.
- I would look at the execution plan first.Najpierw spojrzę na plan wykonania.
- That query uses an index, so it is fast.To zapytanie używa indeksu, więc jest szybkie.
- In our system, the source of truth is…W naszym systemie źródłem prawdy jest…
- I would measure before I optimise.Najpierw zmierzę, a dopiero potem będę optymalizować.
Typowe błędy
- Mówienie „NoSQL jest szybszy”. Szybszy w czym? Nazwij wzorzec dostępu.
- Dodawanie indeksów wszędzie. Wspomnij o koszcie zapisu i o tym, że sprawdzasz plan.
- Mylenie litery C w ACID (poprawność danych według reguł) z C w twierdzeniu CAP (spójność między węzłami). Powiedz, o którą ci chodzi.
- Niemówienie o tym, jak sprawdzono poprawkę. Wspomnij o planie, czasie wykonania i ilości danych.
Najczęstsze pytania
Ile SQL-a trzeba napisać na rozmowie?
Często krótkie zapytanie na wspólnym ekranie lub na papierze: złączenie, group by, czasem funkcję okna. Powiedz plan, zanim zaczniesz pisać: "First I join orders to customers, then I group by month."
Którą bazę danych podać jako najlepiej znaną?
Tę, z którą masz realne doświadczenie. PostgreSQL i MySQL są najpopularniejsze, a warto opowiedzieć, jakie zadania były z nimi związane: projektowanie schematu, strojenie i migracje.
Czy trzeba znać wnętrze baz danych?
Na większości stanowisk wystarczy prosty obraz: indeksy B-tree, write-ahead log (dziennik zapisu z wyprzedzeniem) i to, jak transakcje izolują się nawzajem. Głębsza wiedza liczy się na stanowiskach związanych z bazami danych lub platformami danych.
Przeczytać odpowiedź to nie to samo, co ją wypowiedzieć. Przećwicz każde pytanie na głos, a potem porównaj sens i język własnej odpowiedzi.
Wypróbuj SpeakRole ↗Inne tematy w tym obszarze