Database / Supabase Intermediate to Advanced Interview Questions
When should you use a JSONB column instead of creating additional relational tables?
JSONB makes sense when the data's shape is genuinely variable or unknown ahead of time — user-defined custom fields, a webhook payload from a third-party service, or app configuration that changes per customer — where forcing a fixed table structure would mean constant migrations just to add new fields.
It's a poor fit when the data has a stable, well-understood shape and you'll need to filter, join, or aggregate on individual fields frequently, since those operations are more efficient and more expressive against dedicated columns with proper types and indexes. A reasonable middle ground many teams use is normalizing the fields that are queried often and filterable, while keeping a JSONB column for genuinely miscellaneous or long-tail data that doesn't justify its own column.
More Related questions...