ngraphql icon indicating copy to clipboard operation
ngraphql copied to clipboard

N+1 issue on 1 to 1 field

Open jasonlaw opened this issue 2 months ago • 1 comments

I have a table with few one to one fields. If we select a list of the table, we would expect those 1 to 1 fields will be smarly retrieved in a single query right? It seems retrieving 1 by 1 for each row of the table. Is this normal?

jasonlaw avatar Oct 17 '25 13:10 jasonlaw

that's an overlook, looks like smart load does not cover the one-to-one links. You can try a workaround - after retrieving 'headers', collect Ids and make explicit query to read one-to-one linked entities. that will put them into cache inside entity session, and they will be looked up from there. I will address this in the next iteration

rivantsov avatar Oct 19 '25 18:10 rivantsov