SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

The Rich Rewards of Tuning SQL

By Tony Davis, 2009/11/02

Total article views: 168 | Views in the last 30 days: 12

The past years have been a halcyon period in terms of ever-increasing processor power / clock speed. However, this has often been used to hide a multitude of coding sins. Got a major performance issue on your system? No problem, throw hardware at it, make it go away (at least for the time being).

However, anyone tempted into this "kill it with iron" approach to resolving performance issues should first take a look at the famous Tally table thread on the SQLServerCentral forums or, more recently, Phil Factor's Speed Phreak competition on asksqlservercentral. The latter presents a classic reporting challenge: for a subscription list with 10,000 subscribers, find the fastest way to provide a month-end report detailing the number of current subscribers, and the number of new subscribers and 'un-subscribers' in that month.

Some of the solutions, filled with quirky updates, clever aggregations, pivots, cubes and derived tables, are smart enough to make your eyes water, and will keep lesser mortals scratching their heads for a while. However, the effort it takes to try to understand them will bear rich rewards.

Tests performed on a million-row sample database revealed a tenfold increase in performance from a "so-so" SQL solution (4000 ms) to a "solid" SQL solution (400 ms). And as the host himself, Phil Factor, comments, even the ho-hum solutions are a lot better than much of the cursor-ridden production code that is so prevalent.

If this is the sort of reward to be reaped from tuning just one of the tens of typical reporting queries that make up your average application, then maybe the next time you are tempted to "kill it with iron", why not instead invest that time in hammering and refining your SQL queries? After all, how much money would you have to throw at hardware in order to see a comparable 10-fold performance benefit?

Cheers,

Tony.

By Tony Davis, 2009/11/02

Total article views: 168 | Views in the last 30 days: 12
Your response
 
 
Related Articles
FORUM

jump to report solution need

jump to report solution need

SCRIPT

Listing Subscribed SSRS Reports including Parameters & their Values

This script will allow user to analysis their Subscribed Reports.

FORUM

BIDS Solution/Project shows no reports now

BIDS Solution/Project won't build now after I moved a few reports in SQL Studio

ARTICLE

Data Archiving: Problems and Solutions

SQL Server does an exceptional job at managing your data and making it available for your users and ...

FORUM

Rendering matrix report - performance issue

How to impove performance on rendering a report

Tags
 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com