SQL vs Ecto optimization/translation help

Agreed. Ecto is getting there but like most “ORMs” they optimise for the trivial case which doesn’t exist in real life :slight_smile:

Unfortunately I’ve spent way too much time trying to translate SQL queries into ecto (or other libraries). I still do it because they do add value, but for lots of queries I just use raw SQL.