--- 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. -- slower SELECT * FROM ( SELECT a, b FROM t1 WHERE b!=7 UNION ALL SELECT x, sum(y) FROM t2 WHERE x<9 GROUP BY x HAVING sum(y)>7 ) WHERE a>b; -- faster SELECT * FROM ( SELECT a, b FROM t1 WHERE b!=7 AND a>b UNION ALL SELECT x, sum(y) FROM t2 WHERE x<9 GROUP BY x HAVING sum(y)>7 AND x>sum(y) ); ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------