SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Query taking long time


Query taking long time

Author
Message
dastagiri16
dastagiri16
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2377 Visits: 556
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
Jay-B 46467
SSC-Enthusiastic
SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)

Group: General Forum Members
Points: 167 Visits: 3
  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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search