Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

performance question: union all with or without sub-select?

Status
Not open for further replies.

mbrenner

Programmer
Oct 5, 2006
4
US
i'm using a sqlite database and have to query similar fields spread across 3-5 tables, so in other words, the schema of the tables are the same.

now, what you guys think is faster, more performant in general?


SELECT ... FROM table1 WHERE ...
UNION ALL
SELECT ... FROM table2 WHERE ...
...
ORDER BY ...;


or


SELECT ... FROM
(SELECT * FROM table1 UNION ALL SELECT * FROM table2 ...)
WHERE ...
ORDER BY ...;


thanks
 
just want to add, that the WHERE statement is the same in all cases - all tables have the same scheme.
 
This topic has already been posted, and is being dealt with, in the ANSI SQL forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top