ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abdullah Kauchali <abdullah.kauch...@isanusi.com>
Subject Re: What is N+1
Date Wed, 09 Feb 2005 11:57:10 GMT
What about relationships from the child up to the parent?  Are they also 
classified as N+1?

Suppose we have child table with a fk of parent_id. 

if I do:


I'll get a column with parent_id with values.

Now suppose I also want details pertaining to the parent_id along with 
the recordset of Child, I need not
do 10 separate selects for the parent ...  is this also an N+1 problem?

What is the preferred iBatis model for this?



Kris Jenkins wrote:

> friendVU admin wrote:
>> What is n+1?
>> .V
> n++!   :-P
> It's when each child object in a complex query has to be selected 
> seperately.  If 'parent' has 10 'children', you end up with 10+1 
> select statements being issued.  See the developer's guide under 
> 'Avoiding N+1 selects' for the full lowdown.  Version 2.0.9 comes with 
> new groupBy goodness to banish the N+1 problem.
> Kris

View raw message