Hi, Thanks for reply. I'm still confused about that. I don't know much about SQLite internals, But what i understanded from your reply that SQLite fetch any row match the query condation and then apply to it the GROUP BY then apply to it the ORDER BY is there is any, And when the LIMIT appears SQLite keep fetching the result from the "start" until the result set size equals the requested limit.
Do you mean the LIMIT in SQLite is not optimized? and the performance of selecting from table contains 1000 rows match the query condation equal selecting the same condation with limit 990,10? Thanks, Mina. On 8/17/07, Joe Wilson <[EMAIL PROTECTED]> wrote: > --- Mina R Waheeb <[EMAIL PROTECTED]> wrote: > > I have some questions about the behavior of aggregate functions and > > the result LIMIT. > > After register TEST function and executing query (SELECT TEST() FROM > > objects group by id LIMIT 30,3) > > > > I was expect calling back TEST() only 3 times but what happened is the > > TEST() is called 33 time, and the result set is correct 3 rows. > > Test() would (and should) be called for each row in the > table "objects". How else could it aggregate the information? > > > My questions: > > - Why TEST() is called for non-result rows? Is this designed feature? > > Regarding non-results rows - you only know that after the fact that it's > a non result row - after all rows are processed. Do the query yourself > manually on paper and see. > > > - When the evaluation of the result-column functions happen? > > - How SQLite preform the LIMIT? > > Logically, it operates on the result set after the GROUP BY. > In code, it is more involved than that. > > Also keep in mind that you're assuming that GROUP BY does an ordering > on "id". In SQLite it happens to be the case because of its use > of btrees, but this is not guaranteed on other databases where they > may use a hash map for group by. You need an explicit "ORDER BY id" > to guarantee an order. > > > > ____________________________________________________________________________________ > Got a little couch potato? > Check out fun summer activities for kids. > http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz > > ----------------------------------------------------------------------------- > To unsubscribe, send email to [EMAIL PROTECTED] > ----------------------------------------------------------------------------- > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------