Checklist: SQL Server Performance

-- MSSQL 2010. 2. 16. 18:22
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
Improving .NET Application Performance and Scalability

J.D. Meier, Srinath Vasireddy, Ashish Babbar, and Alex Mackman
Microsoft Corporation

May 2004

Related Links

Home Page for Improving .NET Application Performance and Scalability

Send feedback to Scale@microsoft.com

patterns & practices Library

How to Use This Checklist

This checklist is a companion to Chapter 14, "Improving SQL Server Performance"


SQL: Scale Up vs. Scale Out

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifOptimize the application before scaling up or scaling out.
ms979169.checkbox(en-us,MSDN.10).gifAddress historical and reporting data.
ms979169.checkbox(en-us,MSDN.10).gifScale up for most applications.
ms979169.checkbox(en-us,MSDN.10).gifScale out when scaling up does not suffice or is cost-prohibitive.


Schema

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifDevote the appropriate resources to schema design.
ms979169.checkbox(en-us,MSDN.10).gifSeparate online analytical processing (OLAP) and online transaction processing (OLTP) workloads.
ms979169.checkbox(en-us,MSDN.10).gifNormalize first, denormalize later for performance.
ms979169.checkbox(en-us,MSDN.10).gifDefine all primary keys and foreign key relationships.
ms979169.checkbox(en-us,MSDN.10).gifDefine all unique constraints and check constraints.
ms979169.checkbox(en-us,MSDN.10).gifChoose the most appropriate data type.
ms979169.checkbox(en-us,MSDN.10).gifUse indexed views for denormalization.
ms979169.checkbox(en-us,MSDN.10).gifPartition tables vertically and horizontally.


Queries

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifKnow the performance and scalability characteristics of queries.
ms979169.checkbox(en-us,MSDN.10).gifWrite correctly formed queries.
ms979169.checkbox(en-us,MSDN.10).gifReturn only the rows and columns needed.
ms979169.checkbox(en-us,MSDN.10).gifAvoid expensive operators such as NOT LIKE.
ms979169.checkbox(en-us,MSDN.10).gifAvoid explicit or implicit functions in WHERE clauses.
ms979169.checkbox(en-us,MSDN.10).gifUse locking and isolation level hints to minimize locking.
ms979169.checkbox(en-us,MSDN.10).gifUse stored procedures or parameterized queries.
ms979169.checkbox(en-us,MSDN.10).gifMinimize cursor use.
ms979169.checkbox(en-us,MSDN.10).gifAvoid long actions in triggers.
ms979169.checkbox(en-us,MSDN.10).gifUse temporary tables and table variables appropriately.
ms979169.checkbox(en-us,MSDN.10).gifLimit query and index hint use.
ms979169.checkbox(en-us,MSDN.10).gifFully qualify database objects.


Indexes

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifCreate indexes based on use.
ms979169.checkbox(en-us,MSDN.10).gifKeep clustered index keys as small as possible.
ms979169.checkbox(en-us,MSDN.10).gifConsider range data for clustered indexes.
ms979169.checkbox(en-us,MSDN.10).gifCreate an index on all foreign keys.
ms979169.checkbox(en-us,MSDN.10).gifCreate highly selective indexes.
ms979169.checkbox(en-us,MSDN.10).gifCreate a covering index for often-used, high-impact queries.
ms979169.checkbox(en-us,MSDN.10).gifUse multiple narrow indexes rather than a few wide indexes.
ms979169.checkbox(en-us,MSDN.10).gifCreate composite indexes with the most restrictive column first.
ms979169.checkbox(en-us,MSDN.10).gifConsider indexes on columns used in WHERE, ORDER BY, GROUP BY, and DISTINCT clauses.
ms979169.checkbox(en-us,MSDN.10).gifRemove unused indexes.
ms979169.checkbox(en-us,MSDN.10).gifUse the Index Tuning Wizard.


Transactions

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifAvoid long-running transactions.
ms979169.checkbox(en-us,MSDN.10).gifAvoid transactions that require user input to commit.
ms979169.checkbox(en-us,MSDN.10).gifAccess heavily used data at the end of the transaction.
ms979169.checkbox(en-us,MSDN.10).gifTry to access resources in the same order.
ms979169.checkbox(en-us,MSDN.10).gifUse isolation level hints to minimize locking.
ms979169.checkbox(en-us,MSDN.10).gifEnsure that explicit transactions commit or roll back.


Stored Procedures

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifUse Set NOCOUNT ON in stored procedures.
ms979169.checkbox(en-us,MSDN.10).gifDo not use the sp_prefix for custom stored procedures.


Execution Plans

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifEvaluate the query execution plan.
ms979169.checkbox(en-us,MSDN.10).gifAvoid table and index scans.
ms979169.checkbox(en-us,MSDN.10).gifEvaluate hash joins.
ms979169.checkbox(en-us,MSDN.10).gifEvaluate bookmarks.
ms979169.checkbox(en-us,MSDN.10).gifEvaluate sorts and filters.
ms979169.checkbox(en-us,MSDN.10).gifCompare actual versus estimated rows and executions.


Execution Plan Recompiles

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifUse stored procedures or parameterized queries.
ms979169.checkbox(en-us,MSDN.10).gifUse sp_executesql for dynamic code.
ms979169.checkbox(en-us,MSDN.10).gifAvoid interleaving data definition language (DDL) and data manipulation language (DML) in stored procedures, including the tempdb database DDL.
ms979169.checkbox(en-us,MSDN.10).gifAvoid cursors over temporary tables.


SQL XML

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifAvoid OPENXML over large XML documents.
ms979169.checkbox(en-us,MSDN.10).gifAvoid large numbers of concurrent OPENXML statements over XML documents.


Tuning

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifUse SQL Profiler to identify long-running queries.
ms979169.checkbox(en-us,MSDN.10).gifTake note of small queries called often.
ms979169.checkbox(en-us,MSDN.10).gifUse sp_lock and sp_who2 to evaluate locking and blocking.
ms979169.checkbox(en-us,MSDN.10).gifEvaluate waittype and waittime in master..sysprocesses.
ms979169.checkbox(en-us,MSDN.10).gifUse DBCC OPENTRAN to locate long-running transactions.


Testing

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifEnsure that your transactions logs do not fill up.
ms979169.checkbox(en-us,MSDN.10).gifBudget your database growth.
ms979169.checkbox(en-us,MSDN.10).gifUse tools to populate data.
ms979169.checkbox(en-us,MSDN.10).gifUse existing production data.
ms979169.checkbox(en-us,MSDN.10).gifUse common user scenarios, with appropriate balances between reads and writes.
ms979169.checkbox(en-us,MSDN.10).gifUse testing tools to perform stress and load tests on the system.


Monitoring

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifKeep statistics up to date.
ms979169.checkbox(en-us,MSDN.10).gifUse SQL Profiler to tune long-running queries.
ms979169.checkbox(en-us,MSDN.10).gifUse SQL Profiler to monitor table and index scans.
ms979169.checkbox(en-us,MSDN.10).gifUse Performance Monitor to monitor high resource usage.
ms979169.checkbox(en-us,MSDN.10).gifSet up an operations and development feedback loop.


Deployment Considerations

CheckDescription
ms979169.checkbox(en-us,MSDN.10).gifUse default server configuration settings for most applications.
ms979169.checkbox(en-us,MSDN.10).gifLocate logs and the tempdb database on separate devices from the data.
ms979169.checkbox(en-us,MSDN.10).gifProvide separate devices for heavily accessed tables and indexes.
ms979169.checkbox(en-us,MSDN.10).gifUse the correct RAID configuration.
ms979169.checkbox(en-us,MSDN.10).gifUse multiple disk controllers.
ms979169.checkbox(en-us,MSDN.10).gifPre-grow databases and logs to avoid automatic growth and fragmentation performance impact.
ms979169.checkbox(en-us,MSDN.10).gifMaximize available memory.
ms979169.checkbox(en-us,MSDN.10).gifManage index fragmentation.
ms979169.checkbox(en-us,MSDN.10).gifKeep database administrator tasks in mind.

출처 : http://msdn.microsoft.com/en-us/library/ms979169.aspx
posted by 어린왕자악꿍