How to address the issue with limits on preloaded associations using Ecto?

That won’t work for this, which is the whole problem. If you limit: 10 in a preload query you’ll get back 10 records total not 10 records per item, which is what we want. The only ways I know to get the 10 records per item is via lateral joins or window functions. lateral joins have limited support in ecto, window functions have no support.

6 Likes