I have designed databases several times in my company. To increase the performance of the database, I look for Normalisation and Indexing only.
If you were asked to incr
Compression. For the vast majority of loads I've tried, using compression was a tremendous free ride. Reduced data size means reduced I/O means better throughput. In SQL Server 2005 the compression options are limited (vardecimal
). But I would seriously consider upgrading to 2008 for page compression alone. Or 2008 R2 if you use nvarchar
frequently to get Unicode compression.
Data Retention. Establishing retention policies and deleting old data aggressively. Less data means less I/O, means better throughput. Often this is seen as operational, not design, but I like to think at this issue as an application design issue.
Of course, I assume you already monitor each and every query to ensure none does stupid end-to-end table scans.
Many more performance boosters are mostly operational or deployment, not design: maintenance (defragmentation, index rebuild etc), I/O and storage design etc.
And last but not least understand the hidden cost of various turn-key solutions. Like, say, Replication, or Database Mirroring.
We haven't written about one performance bit:
Hardware.
Databases are intensely I/O driven. Moving to a faster hard drive should increase the speed of database queries. Splitting the database among many fast hard drives might improve it even more.
Optimizing the queries that are used to access that database is most important. Just by adding indexes you don't guarantee that queries will use them.
If a query is extremely mission-critical, you may want to consider de-normalizing, to reduce the number of table-lookups per query. Aside from that, if you need more performance beyond what indexing and de-normalizing can perform, you might want to look program-side: caching, optimizing queries/stored-procedures, etc.
My roll at MySpace was "Performance Enhancement DBA/Developer". I would say that Normalization and Indexes are a requirement in high performance databases, but you must really analyze your table structures and indexes to truly unlock the powers of database design.
Here are a few suggestions I would have for you;
Get to know the DB Engine. A through knowledge of the underlining I/O structure goes a very long way in designing a proper index or table. Using PerfMon and Profiler, alongside your knowledge of what Read/Write I/Os are, you can put some very specific numbers behind your theory of what is a well-formed table / index solution.
Understand the difference between Clustered and Non-Clustered indexes and when to use which.
Use sys.dm_os_waiting_tasks and the sys.dm_os_wait_stats DMVs. They will tell you where you should put your effort into reducing wait-time.
Use DBCC SET STATISTICS IO/TIME ON, and evaluate your execution plans to see if one query reduces or increases the number of page reads or duration.
DBCC SHOWCONTIG will tell you if your tables are heavily fragmented. This is often neglected by developers and Jr. DBAs from a performance point of view - however, this can have a very BIG effect on the number of page-reads you have. If a table has 20% extent page density, that means you're reading about 5 times the data you otherwise would be if the table and it's indexes were defragmented.
Evaluate dirty-reads ( nolock, read uncommited ). If you could do away with millisecond-precision on reads, save the locks!
Consider taking out unnecessary Foreign Keys. They're useful in Dev environments, not on high-performance transactional systems.
Partitions in large tables make a big difference - only if properly designed.
Application changes - If you could schedule batch updates for asynchronous transactions, put them into an index-free heap and process it on schedule so that you don't constently update the tables which you query heavily.
Always Always Always!!! use the same data type variable to query the target columns; For example, the following statement uses a bigint variable for a smallint column:
declare @i bigint set @i = 0
select * from MyTable where Col01SmallInt >= @i
In the process of evaluating index / table pages, the query engine may opt to convert your smallint column data to bigint data type. Consider instead, changing your varialbe type, or at-least converting it to smallint in your search condition.
That's all I can think of off the top of my head. If you run into a more specific problem, I would have a more specific answer for you..
There are many things you could do, a lot of them already suggested above. Some that I would look at (in this order):
These are really high level, I would also take a look at what the vendor of your db engine suggests as performance improvements.
Also, I would gauge a list like this against what my boss is willing to pay for and how much time I have. ;)
Hope this helps.