Query taking long time

  • dastagiri16

    Hall of Fame

    Points: 3370

    hi,

    one of the query is having the below parameter

    declare @StartDate DATETIME

    select @StartDate= SWITCHOFFSET(CONVERT(DATETIMEOFFSET, (DATEADD(day, -1, GETDATE()))), '-10:00')

    and we used startdate in where condition.It is taking login time 48 seconds run in one server but when we execute it from linked server through ..its giving result in 2 seconds ..is there any server setting issue ?

  • Jay-B 46467

    SSC Veteran

    Points: 245

    1. look at the execution plan to find clues

    2. Replace the * with the actual column names - don't know why, but it sometimes helps

    3. add index to each column and try (until you find the best one)

    4. try to change the primary key's index type - try Clustered instead of Non-Clustered

    5. try to create a view upon this table and query from the view instead

  • This was removed by the editor as SPAM

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply