...

/

Choose Between Embedded Schemas and Associations

Choose Between Embedded Schemas and Associations

Learn when to prefer embedded schemas over associations, and when not to.

Advantages of embedded schemas

Embedded schemas have some advantages over associations.

  • Since the child records are stored with the parent, we don’t have to use joins or Repo.preload to fetch them. This can help with performance because we can avoid extra round-trips to the database. It also means the data is stored together on disk and in memory, which reduces expensive disk seek ...