Tips for using indexed views in SQL Server 2019 Avoid creating indexes on a view when the queries that use the view don’t contain JOINs or aggregations. In this case, the queries will not take advantages of the view’s indexes and the queries performance will be the same. Don’t create index on column(s) which values has low selectivity. For example,...
Tag: clustered index
Troubleshooting problems with views in SQL Server 2017
Troubleshooting problems with views in SQL Server 2017 If you have problems with views in SQL Server 2017, review this troubleshooting checklist to find potential solutions. 1. You can get the error 1086 when you use FOR XML clause in a view. This error indicates that the FOR XML clause is invalid in views when they contain a set operator....
Tips for using indexes in SQL Server 2017 (Part 2)
Tips for using indexes in SQL Server 2017 (Part 2) If you create a composite (multi-column) index, try to order the columns in the key so that the WHERE clauses of the frequently used queries match the column(s) that are leftmost in the index. The order of the columns in a composite (multi-column) index is very important. The index will...
Tips for using indexes in SQL Server 2017 (Part 1)
Tips for using indexes in SQL Server 2017 (Part 1) Create a clustered index for each table. If you create a table without clustered index, the data rows will not be stored in any particular order. This structure is called a heap. Every time data is inserted into this table, the row will be added to the end of the...
Tips for using indexed views in SQL Server 2017
Tips for using indexed views in SQL Server 2017 Keep the indexes on the views as narrow as possible. Because each index takes up disk space try to minimize the index key’s size to avoid using superfluous disk space. This reduces the number of reads required to read the index and boost overall index performance. Try to create indexes on...
Troubleshooting SQL Server 2016 Indexes (Part 2)
Troubleshooting SQL Server 2016 Indexes (Part 2) If you have problems with SQL Server 2016 indexes, review this troubleshooting checklist to find potential solutions. 1. You can get the error 1775 when create a foreign key constraint. This error indicates that you cannot create foreign key because it references object whose PRIMARY KEY index is disabled. To resolve this problem,...
Tips for using indexes in SQL Server 2016 (Part 2)
Tips for using indexes in SQL Server 2016 (Part 2) Drop indexes that are not used. Because each index take up disk space and slow down the adding, deleting, and updating of rows, you should drop indexes that are not used. You can use Database Engine Tuning Advisor to identify indexes that are not used in your queries. Keep your...
Tips for using indexes in SQL Server 2016 (Part 1)
Tips for using indexes in SQL Server 2016 (Part 1) Consider creating the columnstore indexes on the memory-optimized tables. Beginning with SQL Server 2016, you can create a memory-optimized table with a columnstore index. You can use the ALTER TABLE ADD INDEX statement to add the columnstore index after the memory-optimized table is created. Create a clustered index for each...
Troubleshooting SQL Server 2014 Indexes (Part 1)
Troubleshooting SQL Server 2014 Indexes (Part 1) If you have problems with SQL Server 2014 indexes, review this troubleshooting checklist to find potential solutions. 1. Install the latest SQL Server 2014 service pack. Because many SQL Server 2014 indexes bugs were fixed in SQL Server service packs, you should install the latest SQL Server service pack. At the time this […]
Understanding SQL Database Indexes — (Part -1)
Understanding Database Indexes – (Part – 1) Author: Basit A. Farooq Editor’s Note: In this two part article series, you will learn about SQL Server indexes, and how they help to achieve optimal query performance while reducing the overall response time. As databases administrator (DBA) or developer, your one of the most important goal is to ensure that query times […]