[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
SQLServerFAQ_Optimization
Back to Microsoft SQL Server FAQ Main Page.

SQL Server Optimization tips

On this page I have tried to collect a few hints about how you can more performance from your SQL-Server database.

Stored Procedures
  • Don't name your stored proceedures sp_MyStoredProcedure. Starting the name with sp_ results takes longer time as the server always checks the Master database first.
  • Use "SET NOCOUNT ON" to prevent the server from returning a message to the client with the number of rows affected by this operation. This is specially usefull if your stored proceedure contains multiple SQL statements.
  • Use "return @@identity" in a stored procedure to return the identity to the client after adding/inserting data to the database. This is must faster than using a select statement to get that information. More information about this can be found here.
  • Use TOP or "SET ROWCOUNT" to limit the number of records returned from a query. It is just a waste of resources to retrieve more records than necessary so making a limit is a good way to boost performance. More details can be found here.
  • Use full qualified name when calling stored procedures using this notation ServerName.DatabaseName.OwnerName.StoredProcedure. Using this notiation the SQL-Server will find your stored procedure faster.




More optimization tips can be found here : http://www.programmersheaven.com/zone18/articles/article617.htm

last edited (October 4, 2004) by WEBMASTER, Number of views: 3169, Current Rev: 7 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.