Hi, I've currently got a view, that uses this statement: SELECT DISTINCT h.Name, h.Manufacturer, h.Model, h.HandsetID, h.LaunchDate, h.Features, h.Description FROM dbo.tHandset AS h INNER JOIN dbo.tDeal AS d ON h.HandsetID = d.HandsetID I was just wondering if there was a way to improve the performance? I tried to index the view, but as I am using DISTINCT and a join, it wont let me
Yes, You can use covering index to improve your performance. If I am not wrong you are using Sql 2005 as this post belongs to SQL 2005 forum and If you have any nonclustered Index on the Table tHandset then just use the concept of Include Columns and add your select columns into the index. (As per your query) Hope it will give you better performance than previous one. Thanks, Sandy.
try creating clustered indexes on handsetid column on both tables; assuming that its integer data column with non duplicate records and use where clause to restrict number of records for distinct operation.
what about using the indexed views [] Improving Performance with SQL Server 2005 Indexed Views http://technet.microsoft.com/en-us/library/cc917715.aspx
MohammedU, He is unable to use Index on view as he posted before. [quote user="alexjamesbrown"]I tried to index the view, but as I am using DISTINCT and a join, it wont let me [/quote] So better to have include column on the nonclustered index. Please correct me If I am wrong Thanks, Sandy.