Tips for using temporary tables in SQL Server 2017 Consider creating indexes on the very large temporary tables. The temporary tables provides much more efficient way to access their data in comparison with general tables, but if you work with very large temporary tables, using indexes can greatly improve performance. Use Table data type instead of temporary tables whenever possible....
Tag: SQL Server 2017
Tips for using linked servers in SQL Server 2017
Tips for using linked servers in SQL Server 2017 Ensure that the connection between the linked servers is fast. Ideally, the linked servers should be in the same subnet. Try to avoid using distribution transaction or minimize it using. Because distribution transactions incur more overhead than general transactions, avoid using distribution transactions, whenever possible. One of the first steps to...
Some tips for using DBCC commands in SQL Server 2017
Some tips for using DBCC commands in SQL Server 2017 Use the DBCC SHOW_STATISTICS command to displays the current distribution statistics for the specified target on the specified table. You can use this DBCC command to see how distributed the data is and whether the index is really a good candidate or not. Avoid using the DBCC SHOWCONTIG command. This...
Some tips for using jobs in SQL Server 2017
Some tips for using jobs in SQL Server 2017 Try to separate very large job into several small jobs. This can improve performance, and can be useful to maintenance the jobs and locate any problems. Specify the understandable job name. Try to specify the job’s name so, that the name describes what the job makes. By using so, you can...
Tips for using data types in SQL Server 2017
Tips for using data types in SQL Server 2017 Avoid using timestamp column as a primary key. Timestamp is a data type that exposes automatically generated, unique binary numbers within a database. Every time that a row with a timestamp column is modified or inserted, the incremented database rowversion value is inserted in the timestamp column. This property makes a...
Tips for using views in SQL Server 2017
Tips for using views in SQL Server 2017 Consider using stored procedures instead of using views. The stored procedures much more flexible than views. For example, a stored procedure can contain insert, delete, update statements, can call other stored procedures, or extended stored procedures, and so on. Use views instead of heavy-duty queries to reduce network traffic. Using views instead...
Tips for using stored procedures in SQL Server 2017
Tips for using stored procedures in SQL Server 2017 Consider using natively compiled stored procedures. Natively compiled stored procedures are Transact-SQL stored procedures compiled to native code. These stored procedures allow for efficient execution of the queries and business logic in the stored procedure. The difference between interpreted (disk-based) stored procedures and natively compiled stored procedures is that an interpreted...
Tips for using table hints in SQL Server 2017
Tips for using table hints in SQL Server 2017 If you want to set any table hints, do not remember to test the query with hint and without the hint and compare results. Because SQL Server 2017 query optimizer usually proposes the best execution plan, you should test the query with table hint and use this hint only when it...
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 full-text search in SQL Server 2017
Tips for using full-text search in SQL Server 2017 Make full-text index population during periods of low database access. Because full-text index population takes some time, these updates should be scheduled during CPU idle time and slow production periods. Reduce the full-text unique key size. To create a full-text index, the table to be indexed must have a unique index....