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


Slow performance


Slow performance

Author
Message
infexthenna
infexthenna
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 5
I have face slow to retrieve the data from particular table.

This table frequently data inserted and same time 50 user will access this table. can you please provide the any suggestions.


Select Top 1 Q.UniqueId From DataQueue Q Where (((Q.field1= 1) And (Q.Status = 'ND')))
And Q.Status Not In ('A', 'B')
And 0 = (Select Count(*) From DataQueue Where ImageId = Q.ImageId And FieldId = Q.FieldId And field7= 2)
And Q.BatchPriority <> 0 And Q.field4<> 0 And Q.KeyingLocation = 'E'
Order By Q.field2, Q.field1 Asc, Q.field3, Q.field5, Q.field4, Q.field6
Attachments
plan2.png (6 views, 18.00 KB)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)

Group: General Forum Members
Points: 90961 Visits: 45284
Not without a lot more information. Need table definitions, index definitions, queries, execution plans.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


infexthenna
infexthenna
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 5
Select Top 1 Q.UniqueId From DataQueue Q Where (((Q.field1= 1) And (Q.Status = 'ND')))
And Q.Status Not In ('A', 'B')
And 0 = (Select Count(*) From DataQueue Where ImageId = Q.ImageId And FieldId = Q.FieldId And field7= 2)
And Q.BatchPriority <> 0 And Q.field4<> 0 And Q.KeyingLocation = 'E'
Order By Q.field2, Q.field1 Asc, Q.field3, Q.field5, Q.field4, Q.field6
Steve Hall
Steve Hall
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2907 Visits: 11573
This article shows you how to post enough information to be helpful to everyone that is willing to assist you:

http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Once enough information is supplied there will be no end of (generally) helpful advice but we do need to know more than just the text of the query.

Steve Hall
Linkedin
Blog Site
T.Ashish
T.Ashish
SSC Eights!
SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)

Group: General Forum Members
Points: 923 Visits: 599
infexthenna (11/7/2013)
Select Top 1 Q.UniqueId From DataQueue Q Where (((Q.field1= 1) And (Q.Status = 'ND')))
And Q.Status Not In ('A', 'B')
And 0 = (Select Count(*) From DataQueue Where ImageId = Q.ImageId And FieldId = Q.FieldId And field7= 2)
And Q.BatchPriority <> 0 And Q.field4<> 0 And Q.KeyingLocation = 'E'
Order By Q.field2, Q.field1 Asc, Q.field3, Q.field5, Q.field4, Q.field6


Do you have Q.BatchPriority and And Q.field4 less then 0 also? And why Q.field1 Asc is written in order by?
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)SSC Guru (90K reputation)

Group: General Forum Members
Points: 90147 Visits: 41146
I believe that I'd change the following code to a NOT EXISTS instead of doing a count.

And 0 = (Select Count(*) From DataQueue Where ImageId = Q.ImageId And FieldId = Q.FieldId And field7= 2)

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
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