Solved

Slow procedures, Sort Warnings and Execution Plans

Posted on 2004-10-07
6
306 Views
Last Modified: 2008-02-01
Experts,

One of my customers (a bank) has a dual processor 4GB database server that, at random times, exhibits extremely slow performance when running one particular procedure.  The database is no more than 8GB in total size so they have enough memory to absorb 50% of their data at a time.  
They are looking to me to resolve their performance.

I have run a basic SQL Profile and the trace reveals, that at the time in question, the proc required a long duration (several minutes!) and gerenated enormous number of reads.  The trace also reports multiple sort warnings although they are coming from different SPIDs which suggests the sort warnings are knock on effect of the rogue proc rather than from the proc itself.

We have extracted the long-running procedure calls from the trace, and when executed via Query Analyser, the proc runs fine.  The execution plan reveals nothing obvious i.e it uses mostly index scans/seeks and no table scans.

I have also checked that the indexes in their live environment match that of our product specification.  All relevant indexes appear to be in place and the indexes are regularly maintained.

So I'm a bit stuck on how to proceed and would like some advice.  Given that they are a bank and this is their live environment, they will be reluctant to release a copy of the database to us.  Hence I am looking for some further diagnostics steps that they can run of the live database

Please help...I'm getting pressure to resolve this.
Thanks
Meowsh
0
Comment
Question by:meowsh
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:arbert
ID: 12252429
Post the procedure.  Lots of time, the SQL will run faster in Query Analyzer because you don't use parms and just execute the SQL.

I'm guess the proc my be suffering from parameter sniffing.

Brett
0
 
LVL 34

Accepted Solution

by:
arbert earned 250 total points
ID: 12252435
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 12252466
when was the last time thier indexes were rebuild.

Do they do alot of heavy functioning like lots of casting, or substrings, or any other functions like that.

are they using the right datatypes on all thier columns? integer searching / sorting / joining is the fastest.

and the main question ( which i probably know the answer to )

Is there database normalized? Do they have redundant data or repeating groups?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 15

Expert Comment

by:justinbillig
ID: 12252491
0
 
LVL 34

Expert Comment

by:arbert
ID: 12252536
"when was the last time thier indexes were rebuild.

Do they do alot of heavy functioning like lots of casting, or substrings, or any other functions like that.

are they using the right datatypes on all thier columns? integer searching / sorting / joining is the fastest.

and the main question ( which i probably know the answer to )

Is there database normalized? Do they have redundant data or repeating groups?"


If it runs fast in analyzer but not the proc, probably not a structure problem....
0
 
LVL 18

Expert Comment

by:mdougan
ID: 12253960
Hi meowsh,

Some other thoughts... sometimes, intermittent performance problems can result from things such as  not running statistics on tables that have a high degree of inserts/updates/deletes.... or, the production database does not have the same indexes which exist on the development database.... or, the area where the data files are located for the temp db are low on available drive space... this causes lots of paging and can really tank the execution of an innocent query.  Another problem can result from locks... so, when experiencing the performance  hit, take a look at Current Activity, and see what locks are being  held... we've added  the  WITH (NOLOCK) to almost all of our Select statements which only retrieve data for read only access, as that prevents blocking locks on the tables which are used by many other procedures.

Cheers!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

860 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