Alle FachrichtungenTechnologie · Vorstellungsgespräch

Datenbanken

Bei Datenbankfragen mischen sich Theorie und echte Vorfälle. Seien Sie bereit zu erklären, wie etwas funktioniert und wie Sie in der Produktion eine langsame Abfrage gefunden haben.

Wörter → Wendungen → Sätze → Sprechen

SpeakRole ausprobieren ↗
VorstellungsgesprächDatenbanken
V

When would you choose a relational database over a document store?

0:18
Interviewfrage

Datenbanken

Datenbank-Gespräche gehen meist von den Grundlagen (SQL, Joins, Indizes) zu Transaktionen und Performance. Für den mündlichen Teil ist die Schlüsselfähigkeit, eine technische Idee einfach zu erklären, ohne sie an einem Whiteboard zu zeichnen.

Nutzen Sie Kontraste, damit Ihre Antworten klar werden: „mit einem Index macht die Datenbank X, ohne ihn macht sie Y“. Kontraste kann sich der Zuhörer leicht merken, und Sie können sie leicht auf Englisch sagen.

  • ✓Wörter → Wendungen → Sätze → Sprechen
  • ✓Sinn der Antwort
  • ✓Sprache

Häufige Fragen und Beispielantworten

When would you choose a relational database over a document store?

Wann würden Sie eine relationale Datenbank einem Document Store vorziehen?

Was der Interviewer hören möchte. Konkrete Kriterien und das Bewusstsein, dass viele Systeme beides einsetzen.

Beispielantwort auf Englisch zum lauten Üben

I 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?

Wie funktioniert ein Index, und was kostet er?

Was der Interviewer hören möchte. Die Struktur, der Nutzen, die Kosten beim Schreiben und die Reihenfolge der Spalten in zusammengesetzten Indizes.

Beispielantwort auf Englisch zum lauten Üben

An 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?

Was bedeutet ACID?

Was der Interviewer hören möchte. Vier Eigenschaften, an einem Beispiel erklärt.

Beispielantwort auf Englisch zum lauten Üben

ACID 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?

Eine Abfrage ist in der Produktion langsam. Was tun Sie?

Was der Interviewer hören möchte. Eine Methode: messen, den Plan lesen, beheben, überprüfen.

Beispielantwort auf Englisch zum lauten Üben

First 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?

Was sind Isolationsstufen, und welche Probleme verhindern sie?

Was der Interviewer hören möchte. Dirty Reads, Non-repeatable Reads und Phantome sowie der Zielkonflikt mit der Nebenläufigkeit.

Beispielantwort auf Englisch zum lauten Üben

Isolation 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.

So sprechen Sie die wichtigsten Begriffe aus

SQL
Es-Kju-El oder „SI-kwel“
schema
SKIE-ma
query
KWIE-ri
ACID
ÄS-id
normalisation
nor-me-lai-SEJ-schen
transaction
trän-SÄK-schen

Nützliche Formulierungen für die Antwort

  • The database has to scan the whole table.Die Datenbank muss die gesamte Tabelle durchsuchen.
  • It trades read speed for write cost.Es tauscht Lesegeschwindigkeit gegen Schreibkosten ein.
  • I would look at the execution plan first.Ich würde mir zuerst den Ausführungsplan ansehen.
  • That query uses an index, so it is fast.Diese Abfrage nutzt einen Index, deshalb ist sie schnell.
  • In our system, the source of truth is…In unserem System ist die Source of Truth…
  • I would measure before I optimise.Ich würde messen, bevor ich optimiere.

Typische Fehler

  • Sagen: „NoSQL ist schneller.“ Schneller wofür? Nennen Sie das Zugriffsmuster.
  • Überall Indizes anlegen. Erwähnen Sie die Kosten beim Schreiben und dass Sie den Plan prüfen.
  • Das C in ACID (gültige Daten nach den Regeln) mit dem C im CAP-Theorem (Konsistenz über Knoten hinweg) verwechseln. Sagen Sie, welches Sie meinen.
  • Nicht sagen, wie Sie eine Korrektur überprüft haben. Nennen Sie den Plan, die Laufzeit und die Datenmenge.

Häufig gestellte Fragen

Wie viel SQL muss ich im Gespräch schreiben?

Oft eine kurze Abfrage auf einem geteilten Bildschirm oder auf Papier: einen Join, ein Group by, manchmal eine Window-Funktion. Sagen Sie den Plan, bevor Sie schreiben: „First I join orders to customers, then I group by month.“

Welche Datenbank soll ich als die nennen, die ich am besten kenne?

Die, die Sie wirklich eingesetzt haben. PostgreSQL und MySQL sind am weitesten verbreitet, und Sie sollten sagen, wie Sie sie eingesetzt haben: Schema-Design, Tuning und Migrationen.

Muss ich die Interna von Datenbanken kennen?

Für die meisten Stellen genügt ein einfaches Bild: B-Tree-Indizes, das Write-ahead Log und wie Transaktionen einander isolieren. Tieferes Wissen ist für Stellen im Datenbank- oder Datenplattform-Bereich wichtig.

Eine Antwort zu lesen ist nicht dasselbe, wie sie auszusprechen. Üben Sie jede Frage laut und vergleichen Sie danach Inhalt und Sprache Ihrer eigenen Antwort.

SpeakRole ausprobieren ↗

Weitere Themen in diesem Bereich