What to choose for performance SubQuery or Joins Part 62

C#, SQL Server, WCF, MVC and ASP .NET video tutorials for beginners What to choose for performance - SubQuery or Joins - Part 62 Link for text version of this video: According to MSDN, in sql server, in most cases, there is usually no performance difference between queries that uses sub-queries and equivalent queries using joins. For example, on my machine I have 400,000 records in tblProducts table 600,000 records in tblProductSales tables The following query, returns, the list of products that we have sold atleast once. This query is formed using sub-queries. When I execute this query I get 306,199 rows in 6 seconds Select Id, Name, Description from tblProducts where ID IN ( Select ProductId from tblProductSales ) At this stage please clean the query and execution plan cache using the following T-SQL command. CHECKPOINT; GO DBCC DROPCLEANBUFFERS; Go DBCC FREEPROCC
Back to Top