cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <agalla...@agsoftware.dnsalias.com>
Subject Re: [ESQL] Improvement....
Date Sun, 26 Jan 2003 22:49:00 GMT
Torsten Curdt dijo:
> Antonio Gallardo wrote:
>> Torsten Curdt dijo:
>>
>>>>WHAT IS WRONG?
>>>>
>>>>In example A all is OK.
>>>>
>>>>In example B we are not using the power of the Database Manager.
>>>>
>>>>WHY?
>>>>
>>>>The LIMIT clause was designed to tell the database engine:
>>>>
>>>>"Let find just X rows", then the database engine when it got the X
>>>> rows stop searching and return the X rows. It improves the response
>>>> time, since does not to continue searching!
>>>>
>>>>Now think in a 10 million row table and YOU KNOW you need only 5
>>>> rows!
>>>
>>>whether 10 million rows or not - the current sollution will only ask
>>> for
>>> 6 - one additional row. Is that the time penalty you are talking
>>> about?
>>
>>
>> Yes, because you already know that there are only 5 rows for every
>> register. Then the database will search the last 6th row that no
>> exist. Forcing to searh in the ENTIRE table.
>
> No - why do you think the database searches the entire table?!?
> ...this is just a restriction on the resultset!
> --
> Torsten

Because in the table with 10 millions are ONLY 5 rows that meet your WHERE
clausule. you know that because this is a design issue.

But setting "LIMIT 6" force the database to search the 6th row that you
know does not exist. Then the question is:

What do the database to try to find the 6th row?

I think the answer is: scan the rest of the database after finding the
ONLY 5 rows that already exist.





---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message