Hi everyone,
I’m reading Programming Phoenix > 1.4 and in the Persisting Annotations chapter there is the following code:
- def list_annotations(%Video{} = video) do
10: Repo.all(
- from a in Ecto.assoc(video, :annotations),
- order_by: [asc: a.at, asc: a.id],
- limit: 500,
- preload: [:user]
15: )
- end
Looks like this query will fetch the user for every annotation, regardless of whether the user was previously fetched.
What options do we have to solve this?