Niclas Hedhman dijo: > On Monday 27 January 2003 16:01, Torsten Curdt wrote: >> Niclas Hedhman wrote: >> > On Monday 27 January 2003 07:06, Torsten Curdt wrote: >> >>>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. >> >> >> >>No :) ...be sure - it doesn't >> > >> > Well, that depends on the WHERE clause. For instance; >> > >> > WHERE SQRT( SQ( a - b ) + SQ( c - d ) + SQ( e - f ) ) < g ; >> > >> > definately go through every record, whether the fields are indexed >> or not. >> >> Aaah - now I got you guys! (sorry for being that slow ;) >> >> Antonio, how comes that you always know you have 5 rows? This sounds >> quite unusual to me... > > I can answer part of that; > > 1. You have the "count" from somewhere else. > 2. You know that objects of type X has N attributes, always fixed. 3. I > have 10,000,000 random records of N types. I want the first one of each > type. > > Sure there are other cases. > > Niclas
Thanks Niclas! This is the example I tried to explain: I have a table that store the status of some tickets. You always know how many status there can be. If you said: 1-Open 2-Close 3-Invalid Then if you want to show the history, you will ask for LIMIT 3, but the database will try to find the 4th row after finding the only 3 that can exist. This is why I told this is a performance issue. Not an error. Antonio Gallardo > > > --------------------------------------------------------------------- To > unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]