Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

B-Tree vs BRIN for Ledgers

MediumSQL & Data Manipulation00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to your interview.

The question is on your right: B-Tree vs BRIN for Ledgers. Take a moment with it first.

Talk your thinking through with me if you like - when you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes). Discussion and graded submissions share your five interviewer interactions, so spend them well.

You need to log in / sign up to chat or submit.

Problem

Context

In PostgreSQL, index choice can materially change both query latency and ingestion cost, especially on large append-heavy tables such as card authorisations or ledger events.

Question

You are asked to explain how B-Tree indexes differ from BRIN indexes in PostgreSQL. Compare how they store information, what query patterns they support well, and how they affect query performance on large Revolut-style transaction tables. You should also explain write amplification: why some indexes make inserts and updates more expensive, and why BRIN often has a lower maintenance cost than B-Tree.

Scope guidance

A strong medium-level answer should cover physical behavior at a high level, when each index is a good fit, what happens when data is naturally ordered versus randomly distributed, and the trade-off between fast point lookups and cheaper writes. You do not need to discuss every PostgreSQL index type; focus on B-Tree and BRIN with practical examples.