Skip to main content

Data for Elixirs

Ecto is Elixir's database toolkit. It provides a Repo for talking to the database, schemas that map tables to structs, changesets for validating and casting data before writes, a composable query DSL and migrations. It is most often used with PostgreSQL and is not a classic ORM.

Stage: Tooling and Data · Part of the Elixir roadmap · Last reviewed 19 November 2026

What to learn in Data

Data interview questions

What is a changeset in Ecto?

A changeset is a struct that tracks changes to data along with validations and errors. You cast external params into allowed fields, apply validations and constraints, then pass it to Repo.insert or update. Invalid changesets never reach the database.

How do you avoid N+1 queries in Ecto?

Associations are not loaded automatically, so you use preload, either in the query with a join or as a separate batched query through Repo.preload. That fetches related rows for all parents in a fixed number of queries instead of one per parent.

Where Data fits in the Elixir roadmap

Data belongs to the Tooling and Data stage (intermediate level). Real projects.

Back to the full Elixir roadmap