Some tips for designing SQL Server 2016 tables (Part 2) Try to reduce the number of columns in a table. The fewer the number of columns in a table, the less space the table will use, since more rows will fit on a single data page, and less I/O overhead will be required to access the table’s data. Consider using...
Tag: SQL Server 2016
Some tips for designing SQL Server 2016 tables (Part 1)
Some tips for designing SQL Server 2016 tables (Part 1) 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...
Useful Undocumented SQL Server 2016 Stored Procedures (Part 2)
Useful Undocumented SQL Server 2016 Stored Procedures (Part 2) SQL Server 2016 supports the following useful undocumented stored procedures: sp_oledb_database sp_oledb_defdb sp_oledb_deflang sp_oledb_language sp_syscollector_validate_xml sp_xml_schema_rowset sp_xml_schema_rowset2 sp_oledb_database The sp_oledb_database stored procedure returns the oledb database name. Syntax sp_oledb_database Return Code Values None. Result Sets Column name Type Description name sysname The name of the oledb database. Remarks This stored procedure...
Some tips for using SQL Server 2016 distributed queries
Some tips for using SQL Server 2016 distributed queries Try to avoid using distribution queries or minimize it using. Because distribution transactions incur more overhead than general transactions, avoid using distribution queries, whenever possible. The first steps to optimize distributed queries against a SQL Server 2016 linked server is rewriting queries so, that the most work will be performed on...
Some tips for using data types in SQL Server 2016
Some tips for using data types in SQL Server 2016 Use Date/Time data types to store date/time information separately. In SQL Server 2016 you can store the date and time information separately. For example, if you need to work with date data only, use the Date data type instead of datetime or smalldatetime to optimize storage space and simplify date […]
Some tips for SQL Server 2016 clustering
Some tips for SQL Server 2016 clustering Avoid running other software on the SQL Server 2016 cluster nodes. To increase SQL Server 2016 performance, SQL Server clusters should be dedicated to SQL Server only. Consider using Distributed Availability Groups (DAG) if you have two availability groups residing on different Windows Server Failover Clusters (WSFC). DAG enables you to associate two […]
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 […]
Some tips for using query hints in SQL Server 2016
Some tips for using query hints in SQL Server 2016 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. […]
Some tips for using full-text search in SQL Server 2016
Some tips for using full-text search in SQL Server 2016 Use a full-text query instead of the LIKE Transact-SQL predicate if you need to query formatted binary data or query a large amount of unstructured text data. A full-text query against millions of rows of text data can take only seconds; whereas a LIKE query against the same data can […]
Tips for using stored procedures in SQL Server 2016
Tips for using stored procedures in SQL Server 2016 Try to avoid using temporary tables and DDL (Data Definition Language) statements inside your stored procedure. Using temporary tables or DDL statements inside stored procedure reduces the chance to reuse the execution plan. Consider using user-defined table type as a parameter for the stored procedures. SQL Server 2016 supports a user-defined […]