Skip to content
BENIBIX Learn

Schema-on-Read

Data🧭 FoundationsData Modeling

Also known as Schema on Read

Store data as it comes. The shape is set later, when it is read.

Think of it like

It is like a big box you throw toys into. You sort them only when you want to play.

Example

A team dumps raw JSON logs into a data lake each day. Months later, an analyst reads just the city field from them.

Why it matters

You can keep data before you know what you will ask of it. New questions do not need a reload.

Definition

Schema-on-read means data is stored as it comes, with no shape forced on it. The shape is applied later, by the query that reads it. Each reader can pick the fields it needs and how to treat them. This makes loading fast and easy. The cost is that bad data is only found when someone reads it.

Example code

sql
SELECT doc->>'city' AS city, COUNT(*)
FROM raw_events
GROUP BY 1;
The query picks the city field out of raw JSON at read time.

Common mistake

Thinking it means no schema. The schema still exists. It just moves into every query.

Key takeaways

  1. 1
    Load as is. No shape is forced on the way in.
  2. 2
    Shape at query time. The reader picks fields and types.
  3. 3
    Errors show late. Bad data is found on read.

Compare

Learn it properly