cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hunsberger, Peter" <>
Subject RE: [ESQL] Improvement....
Date Mon, 27 Jan 2003 18:06:29 GMT
>>> if (exist <esql:more-results>)
>>>    LIMIT 5+1
>>> else
>>>    LIMIT 5
>> I think this is an elegant solution. What you think?
>> Sure - but the problem is that we also would need to adjust the length
>> of the resultset inside the helper class. (you always want to see only 5 
>> rows in your page)
>> The length of the resultset inside the class would sometimes be one 
>> more
>> and sometimes *exact* - depending on whether there is a <more-results> 
>> tag or not. Which would be very confusing!
>> Give me a day to think about this...
> Torsten,
> You're chasing a non-existent problem.  There is never a real life case
that will have both good 
> performance for N records and bad performance for N+1 records.  

I should have qualified this by adding "for a properly designed database"...

> The only way you can guarantee having good performance for N records is if
you can build an index.
> If you can build an index then the search will always terminate after
looking at N+1 records.

For a poorly designed database (one where you don't have a foreign key to
group by to count your N records) they you might want a hack to force the
query to stop at some count.  However, this shouldn't be the same as the
more-results check.  Instead you need a separate hard stop limit...

To unsubscribe, e-mail:
For additional commands, email:

View raw message