Bad join query when using attribute tenancy
Hi! I'm noticing a major performance bug when using attribute-based multi-tenancy in our app:
We have an a resource
both tables have an attribute
Then I have a calculation that looks like this:
But loading this calculation causes a terrible query:
The unnecessary fields aren't terrible, but loading the entire patient table to get one causes this query to take 300ms instead of a few ms
Is there a way around this?
Ash version:
3.5.13
Ash postgres:
2.5.22
We have an a resource
Visit that has:belongs_to :patient, Practices.Patient, public?: trueboth tables have an attribute
practice_id which is the multitenancy attributeThen I have a calculation that looks like this:
But loading this calculation causes a terrible query:
The unnecessary fields aren't terrible, but loading the entire patient table to get one causes this query to take 300ms instead of a few ms
Is there a way around this?
Ash version:
3.5.13
Ash postgres:
2.5.22
