Ash query with 1 filter performs worse than the same Ecto query
We've noticed quite bad performance when querying data produced by paper_trail using Ash. The same kind of queries made with regular Ecto.Query perform much better.
The tables involved are huge (it's paper trail after all), but the column by which we filter is indexed.
Upon examining the difference between the produced queries, the only difference I see is in the WHERE clause:
Ash:
Ecto:
The
Why is this casting produced in the Ash version of the query necessary? Is it something that can be avoided by better definitions and or configuration?
The tables involved are huge (it's paper trail after all), but the column by which we filter is indexed.
Upon examining the difference between the produced queries, the only difference I see is in the WHERE clause:
Ash:
Ecto:
The
document_id is added to the Version resources using attributes_as_attributes([:document_id]) within paper_trail.Why is this casting produced in the Ash version of the query necessary? Is it something that can be avoided by better definitions and or configuration?
