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]
-----------------------------------------------------------------------------

Reply via email to