General Performance Issues

You need to be aware of a number of general performance issues when writing any type of SQL statement, whether the statement is a simple script, a stored procedure, or a trigger. The following outlines some of the things that you need to keep in mind:

  • When applicable, use fully qualified object names. This approach allows the SQL Server query engine to match existing query plans with the statement being executed, thus speeding up overall execution time.

  • If you know that you will have several applications that will all retrieve the same data from the database using the same parameters, use a stored procedure as opposed to a straight SQL statement. This will allow SQL Server to more easily match the query plans.

  • Close open ...

Get Writing Stored Procedures for Microsoft SQL Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.