Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Performance  tuning  SQL

Posted on 2011-02-15
5
Medium Priority
?
490 Views
Last Modified: 2012-05-11
Experts -

I've a very simple SQL which is performing very poorly.  Most of the time its waiting for Memory/CPU.

Clustered index on PrimaryKey (ID).
Non-Clustered index on NBR

I've nested loop with Non-clustered Seek and Key Lookup on NBR. Is that a normal?

This table has 2 million rows and the rows are not contained in 1 single page.

I can not remove the STARS in the SQL for this time.

Any ideas?

Thanks,

~sve.


ALTER PROCEDURE [dbo].[GetNbr]
	@nbr nvarchar(50)
WITH RECOMPILE	
AS
BEGIN
	SET NOCOUNT ON;
	
	SELECT * FROM big_2milrows_table with(nolock)
	WHERE Number=@NBR
	
END

Open in new window

0
Comment
Question by:sventhan
  • 3
5 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 1000 total points
ID: 34900687
What is the data type of Number column in your table? If it is int, why don't you pass the @nbr  parameter as int?
0
 
LVL 18

Author Comment

by:sventhan
ID: 34900807
Its a varchar(50). Its actually a phone number. Thanks.
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 1000 total points
ID: 34900895
then change the procedure parameter to varchar(50) from nvarchar(50)

when was the last time you rebuild the index?

how many rows are returned for your nbr?

what is the row size?
0
 
LVL 18

Author Closing Comment

by:sventhan
ID: 34900921
Thanks. The problem is something else.
That got fixed.
0
 
LVL 18

Author Comment

by:sventhan
ID: 34901714
@ Lowfatspread

It was the issue with data type mismatch.

Thanks.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question