Thank you for the reply. Is doing a SELECT EXISTS (...) faster than a SELECT COUNT (... LIMIT 1) or would it be the same (I would expect them to be the same, but that's only my guess)?
Regards, Dennis > -----Original Message----- > From: Dennis Cote [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 24, 2007 1:47 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Questions on views > > Dennis Volodomanov wrote: > > > > Is it quicker (slower or the same) to execute a query on a > view or to > > execute the original query from which this view was created? > > > > I'm basically looking for the best (fastest) way to execute > thousands > > of queries to check whether they return any results or not. At the > > moment I'm doing a COUNT, but I'm hoping to find an easier > way than to > > execute count thousands of times... > > > > > Dennis, > > A query on a view will take a little longer to prepare than > the same query used to define the view, but both should > execute at the same speed since sqlite saves and recompiles > the sql code used to define the view. > > You can check for a result from a query using EXISTS faster > than you can count the number of results. Exists tests stop > as soon as they have found a result, count must find all the results. > > select exists( <insert your query here> ); > > HTH > Dennis Cote > > > > -------------------------------------------------------------- > --------------- > To unsubscribe, send email to [EMAIL PROTECTED] > -------------------------------------------------------------- > --------------- > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------