Ecto custom select statement

Hi,

I’m performing a query like this

from(i in Items, select: %{i | cost: fragment("select ?", 100)})

Would the data sent from the db include both the original cost value and the value from the fragment? I’m trying to determine if I can override a field in my table to reduce the amount of data sent into my app.

When you run an Ecto query in dev mode, it will log the query into the console. You can look at it there to see if it selected the cost field or not.

1 Like