Tips for using query hints in SQL Server 2019 If your query is very slow, try the following before using query hints: – rebuild indexes used in the query (or defragment them using DBCC INDEXDEFRAG), – update statistics on the relevant tables, – consider creating new indexes for this query, – rewrite your query to provide better execution plan. Use...
Tag: RECOMPILE
Tips for using query hints in SQL Server 2017
Tips for using query hints in SQL Server 2017 You can use the KEEP PLAN query hint if you want to reduce the estimated recompile threshold for a query. For example, using this hint reduces the number of recompiles when multiple table updates occur. This example shows how you can use the KEEP PLAN hint: SELECT * FROM authors OPTION...
Tips for using query hints in SQL Server 2014
Tips for using query hints in SQL Server 2014 If you want to set any hints for your query, do not remember to test the query with hint and without the hint and compare results. Because SQL Server 2014 query optimizer usually proposes the best execution plan, you should test the query with hint and use this hint only when...
SQL Server 2014: Stored Procedures
SQL Server 2014: Stored Procedures Author: Basit A. Farooq Introduction A stored procedure is a named, precompiled collection of SQL statements, variables, and control-of-flow statements. You can create stored procedures that accept input parameters and return values and status information. Typical uses for stored procedures include automating repetitive tasks, ensuring tasks are performed consistently, enhancing application and user access security...