I am in need of getting data from multiple select queries. So I thought of creating two views and to inner join them to get my data.
My questions is: which option is better
- creating a view,
- creating temporary table
Using two VIEWs in your SELECT statement will always be better because it can combine both of the views query plans into a single optimised query. Very neat solution which is also fast.
BTW. Using an in-memory temp table > 100 rows generally poor performance because the query plan optimiser assumes there is only 1 row in the temp table.