ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Huy <huym...@swiftdsl.com.au>
Subject Re: R: What is N+1
Date Thu, 10 Feb 2005 22:22:37 GMT
friendVU admin wrote:
> Ex: A common thing I used to consult on before Java was Performance and 
> Tuning SQL DBs. A client would have a slow querry, and they say make it 
> fast. I can! I used to take things that take 15 minutes down to split 
> second. One tecquique is to break a complex querry into 2 simpler 
> querries with less joins; even using a temporary tables. This 
> exponentialy increased peformance to sub second.
> (also.. you avoid group by, distinct, order by... imagine sorting 30 
> million records BEFORE you start to returun... and that you have 10,000 
> concurent users each runing a variation on the querry. Lots of trick to 
> get arround that).

I have experienced the same thing .V describes here. I had a query which 
would have subselects counting certain things in the same table several 
times with each subselect having joins to other tables. No amount of 
indexing/joining was able to make it fast so selecting two sets of rows 
and doing the operations manually speed it up dramatically.


> All the best,
> .V
> Clinton Begin wrote:
>> With the N+1 selects solution, you can do this with one query, with
>> one hit to the database -- no matter how many relationships you have
>> or how much data.
>> Trust me bud, this is VERY good advice.
>> Cheers,
>> Clinton

View raw message