Nothing is more dangerous than a programmer pushed into a DBA role who doesn't know crap about databases. Too often, you see consultancies, smaller organizations, and people in general trying to save a buck and not bring any DBA presence on board. Too often I see arrogant developers claim that "DBAs only get in the way" and "I'm not doing anything fancy, I don't need no stinking DBA". To me, this is the equivalent of someone saying "I'm building a house, and I know carpentry, so I'm not hiring a stinking plumber or electrician".
Case in point, I'm taking a look at a software application that seems to be plagued by performance issues. The server, although relatively beefy, is struggling to keep up with what on the front end seem the most simple of requests. So I fire up the SQL Profiler for 20 minutes during the work day when the application is being most utilized and then peek at the results, ordering my profile results (T-SQL and Stored Procedure metrics) by duration and reads. I quickly parse down the lists and find a query that looks up customers by phone number, with the area code and exchange/number separate... what would seem to be a straightforward and low load query.
Here's the metrics from the SQL Trace:
Reads: 416016
Duration: 5422 milliseconds
CPU: 1313
That's a lot of reads, and very very slow as far as I'm concerned. So I pop open the database table to see what kind of indexing is going on. Sadly, there are indexes on the table, but not the appropriate kind. So I blew away the indexes, and recreated them in a more... sensible manner. Then I ran the Profiler and executed a series of similar queries and got the following results:
Reads: 9720
Duration: 78 milliseconds
CPU: 78
As you can see, the performance with a proper index was ASTRONOMICALLY better than the previous setup. I know for a fact that no DBA was involved in the original project and a group of developers with a very high opinion of themselves did everything from start to finish. Hence, my admonition, know your role. Very few people can be all things to all people, and in cases like the one above, even having a minimal DBA presence on the project could have had time spent putting in very basic optimizations like this that could have given much better performance, scalability, and user satisfaction.
Posted
Mon, Aug 28 2006 6:37 PM
by
Eric Wise