Tips for using table hints in SQL Server 2019 If your query is very slow, try the following before using table hints: – rebuild indexes used in the query (or defragment them using the DBCC INDEXDEFRAG command), – update statistics on the relevant tables, – consider creating new indexes for this query, – rewrite your query to provide better execution...
Tag: UPDLOCK
Some tips for using table hints in SQL Server 2016
Some tips for using table hints in SQL Server 2016 Use the INSERT … SELECT statement with the TABLOCK hint. In SQL Server 2016, the insert in an INSERT … SELECT statement is multi-threaded or can have a parallel plan. To get a parallel plan, you can use the compatibility level 130 and the INSERT … SELECT statement must use […]
Tips for using SQL Server 2016 cursors
Tips for using SQL Server 2016 cursors Reduce the number of rows to process in the cursor. To reduce the cursor result set use the WHERE clause in the cursor’s select statement. Do not forget to close SQL Server 2016 cursor when its result set is not needed. To close SQL Server cursor, you can use CLOSE {cursor_name} command. This […]