SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to Increase Query Speed by 3 Orders of Magnitude with no Indexes


How to Increase Query Speed by 3 Orders of Magnitude with no Indexes

Author
Message
Stephen Hirsch
Stephen Hirsch
Old Hand
Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)

Group: General Forum Members
Points: 390 Visits: 161
Comments posted to this topic are about the item How to Increase Query Speed by 3 Orders of Magnitude with no Indexes
MikeAngelastro-571287
MikeAngelastro-571287
SSC Veteran
SSC Veteran (232 reputation)SSC Veteran (232 reputation)SSC Veteran (232 reputation)SSC Veteran (232 reputation)SSC Veteran (232 reputation)SSC Veteran (232 reputation)SSC Veteran (232 reputation)SSC Veteran (232 reputation)

Group: General Forum Members
Points: 232 Visits: 177
Yes. Your boss did the right thing and it was brilliant. But couldn't the three hour query have been the result of an inadequate use-case?
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (147K reputation)SSC Guru (147K reputation)SSC Guru (147K reputation)SSC Guru (147K reputation)SSC Guru (147K reputation)SSC Guru (147K reputation)SSC Guru (147K reputation)SSC Guru (147K reputation)

Group: General Forum Members
Points: 147656 Visits: 41713
A short, sweet, and brilliant article! Bravo Stephen and spot on on all points especially on working with your "customers".

There's only one problem with the scenario you're given... what if the "customers" had said the data had to be "up to date" as in "to the second" (or so)? That probably brings us to the real problem of not having enough time because of poorly estimated schedules or the corner office wants it real bad and, obviously, got it that way or no one really gave a damn when it came to design and coding. It's one of the reasons why I say to always plan and program as if there were at least million rows in each and every table.

I don't know about others but I gave this article 5 stars for the message it carries about working with the customer. By the same token, I could have given this article MINUS 5 stars because (not having ANYTHING to do with the author) the boss actually isn't a hero because he is the one that should have managed things in such a fashion to PREVENT such problems from happening to begin with.

Tell your boss I said "Welcome to the Lucky Rollers Club" and to start taking care of business because the answer could have been a whole lot different. ;-)

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
steve.vidal
steve.vidal
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 26
That's the most misleading title I've seen in a long time...

I was personally interested in the story because I was confronted with a nearly identical situation (Laboratory System with screen taking up to 20 minutes to load). Now in my story, I did improve the query speed by 3 orders of magnitude, not just swipe the problem under the carpet... ;-)

How is this article going to help anyone actually trying to troubleshoot performance issues?Sad
mark.schrier
mark.schrier
SSC Rookie
SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)

Group: General Forum Members
Points: 38 Visits: 13
While it is a cute story, the real meat is in the advice at the end.
1. Get to know your end users as people
2. Learn their jobs and their concerns
3. Don't undertake a design/analysis/programming project if you do not have free access to the end users and stake holders.
4. End users will know significantly more about how they do their jobs and what works than they are given credit for.
5. When an end user has a problem with the solution, always assume there is a problem until your have proof there is not. It is not the end users job to debug your code. Most shops assume there is no problem unless the user can prove it. This approach is fundamentally flawed.

Using these guide lines, projects will run more smoothly and have a much better chance of finishing on target and on time.
Tim Monfries
Tim Monfries
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 137
Solved in terms of perception only.

Your boss fixed the problem of an overly odourous recycling plant by moving it someplace (or perhaps more correctly, sometime) else. The users aren't around to smell it anymore, but the garbage tip still stinks!

I'd like to know what, if anything, was done to fix the underlying design/resource issues that produced the problem in the first place.
SQLRNNR
SQLRNNR
SSC-Forever
SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)

Group: General Forum Members
Points: 48469 Visits: 18569
Nice article. I think this is sometimes overlooked as a valid method to troubleshoot performance problems. The point is to provide a solution that meets the requirements without killing the system.

Thanks very much for sharing.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

AspiringGeek-40457
AspiringGeek-40457
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 112
I'm definitely on the side of calling this an elegant solution. When you can define the frame, you can always win. It's not always this easy to do so, but when possible, ka-ching!



Paul Lancaster
Paul Lancaster
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 130
steve.vidal (7/13/2010)
That's the most misleading title I've seen in a long time...

I was personally interested in the story because I was confronted with a nearly identical situation (Laboratory System with screen taking up to 20 minutes to load). Now in my story, I did improve the query speed by 3 orders of magnitude, not just swipe the problem under the carpet... ;-)

How is this article going to help anyone actually trying to troubleshoot performance issues?Sad



Absolutely agreed! What the article describes is plain common sense; it's doesn't "increase query speed" at all, simply moves the load to a time when systems are under or less utilised. Been doing that for years.
gserdijn
gserdijn
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1514 Visits: 818
As of midnight would be perfectly fine

Good stories usually have a happy ending. Not exactly an eye-opener, but nevertheless a good reminder.

We had it the other way round. Every night a job ran to populate a datawarehouse. The customer asked if it were possible to update the datawarehouse 4 times a day. It was - in this case - possible without any problems. Usually the business rules change for the worse.



Dutch Anti-RBAR League
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search