July 11, 2006 at 10:54 am
Hi,
Does anyone know performance wise, which better a view or a subquery?
Cheers
Reet
July 11, 2006 at 11:07 am
Views and Subqueries cannot be really compared, Views are compared to stored procs and Subqueries are compared to JOINs or UNION. JOINs are the same in performance to Subqueries and in ANSI SQL Subqueries are updatable while JOINs are not but T-SQL let you update JOINs. Now to your questions if you are in SQL Server 2005 lookup CTE(common table expressions) they are in memory Views so faster than the persisted Views and more like compiled stored procs. The reason in ANSI SQL Views are query rewrites just persisted while Subquery do the same thing as a JOIN but are updatable. Hope this helps.
Kind regards,
Gift Peddie
Kind regards,
Gift Peddie
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply