Solved

Performance  tuning  SQL

Posted on 2011-02-15
5
477 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 250 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 250 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

617 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