On 7/6/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
--- Mike Johnston <[EMAIL PROTECTED]> wrote:
> I have to join three tables to retrieve bits of data from each. I'm wondering 
if I use a view
> are there any performance issues vs. issuing the complete 3 table join query 
in code.

As long as your VIEW/subquery does not make use of
UNION/EXCEPT/INTERSECT, then it's usually the same speed.

I would not recommend complex querying of views/subquery of unions
of selects with large result sets within SQLite. The select will run
much faster and use far less memory if you manually expand these
queries to not make use of the VIEW. SQLite will not perform this
optimization for you.

Unless performance issues are really at a premium, I would probably
advise exactly the opposite. In other words, use views if you can,
don't use them only when you must not.

Views have a tendency to decouple the database querying needs from the
code which I find invaluable. Unless there is another mechanism in
SQLite to store queries (pre-compiled or not) similar to stored
procedures, views are probably the best we have.

My understanding of SQLite is still very minimal, so my reply is also
a question in the sense that my extensive usage of views has probably
a better counterpart I'm not aware of.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to