SQL Server Performance

Performance Improvements on a view...

Discussion in 'SQL Server 2005 Performance Tuning for DBAs' started by alexjamesbrown, Jun 11, 2009.

  1. alexjamesbrown New Member

    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
  2. Sandy New Member

    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.
  3. alexjamesbrown New Member

    sorry, im not sure what you mean...
    do you have an example??

  4. Sandy New Member

    Hi Alex,
    You can create the Included column as below script.
  5. deepakontheweb New Member

    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.
  6. MohammedU New Member

  7. Sandy New Member

    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
    So better to have include column on the nonclustered index.
    Please correct me If I am wrong

Share This Page