How to avoid duplicate queries
I am using table with TextColumn, i am fetching custom data from another table based on the id of the $record. For some reason it gives me duplicate entries despite using callback. Any help please?
4 Replies
This is normal as you are using a query in the formatStateUsing
I recommend using join relationship with left join option by modifying the Resource query
it doesn't happened in V2, strange. i have a large data including relationship so are you sure it's normal and won't affect the performance etc?
@kingtox weird to hear that it doesn't happen in v2, as there's clearly a separate DB query for every record.
And yes, my recommendation is the same, to change the initial query to use join, probably
@kingtox I've tried to reproduce it to create a demo video, so here's how you can load that parent relationship directly from TextColumn:
will load only two queries for the relationship, no matter the amount of rows