Check out preload queries, they’re perfect for this: https://hexdocs.pm/ecto/Ecto.Query.html#preload/3-preload-queries