RE: inefficient sql

From: Taylor, Chris David <>
Date: Tue, 29 May 2012 15:28:16 -0500
Message-ID: <>

Something to keep in mind is that many professionals (see Cary Millsap) make a point of illustrating that only inefficient *and* business important SQL be focused on (I'm overs simplifying a little bit). What I mean by this is, suppose you have a query that runs once a week and uses gobs of LIOs. There are lots of questions that you should ask yourself:

a.) is it impacting anyone (i.e. is anyone waiting on it) b.) how many people are waiting on it

Now, some of that goes out the window if your whole system is swamped by a bunch of little once a week SQLs... :)

I guess my only point in this is - don't focus on SQL tuning that isn't impacting anyone.

(apologies to Cary if I misrepresented or overly simplified points made in the past)

Chris Taylor

"Quality is never an accident; it is always the result of intelligent effort."
-- John Ruskin (English Writer 1819-1900)

Any views and/or opinions expressed herein are my own and do not necessarily reflect the views of Ingram Industries, its affiliates, its subsidiaries or its employees.

-----Original Message-----

From: [] On Behalf Of Stephens, Chris Sent: Tuesday, May 29, 2012 3:15 PM
To: ''
Subject: inefficient sql

I'm interested in creating a daily report to run in our development environments to spot inefficient SQL early in the process. I've already got one that lists top ten highest elapsed time and top ten most frequently executed. They have helped tremendously in focusing on the right SQL. However, there is often SQL here that makes its way into integration and production that could be improved upon. (Yes I know where SQL falls in the optimization hierarchy and am well aware that business tasks are what are important but these reports have proved their value over and over.)

I'm pretty confident that a ratio of LIO's to rows returned by each row operation in an SQL execution plan is a good indicator of SQL efficiency. I think I've heard this in a few different presentations. I don't, however, recall what that ratio should be or if I'm misremembering completely.

What do you all consider good indicators of inefficient SQL and how to you identify those statements?


This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by email reply.


-- Received on Tue May 29 2012 - 15:28:16 CDT

Original text of this message