As of SQL Server 2008 Filtered Indexes are introduced. A filtered index allows us to create an index with a filter on a subset of rows within a table. A filtered index will:
Filtered indexes can be very useful on columns which contains mostly NULL values and where the queries retrieve only the rows where the data is NOT NULL. In our Exact Software we have indexes on columns which contain mostly NULL values. See Microsoft website link for more information about filtered indexes.
You can use next query to see the allocated space in your database: EXEC sp_spaceused @updateusage = N'TRUE';To see the difference in index size after implementing the filtered indexes, run this query before and after the filtered index script is executed successfully.
Fill FactorThe attached script will also implement a Fill Factor of 90 for each column of the type uniqueidentifier. This Fill Factor will improve your database performance due to less page splits. See Microsoft website link for more information about performance impact of the Fill Factor.
If you are planning to execute the script, make sure no users are active in the database while you are executing the script! The update process can take about up to 15 minutes for a database size of 30 GB depending on your SQL server hardware specifications.
To implement Filtered Indexes and Fill Factor with SQL Server Management Studio:
Note!When using SDK based solutions (like E-WMS, Incoming Invoice Register, Field Service, custom solutions, etc.) make sure you use release 401 or newer, otherwise the SDK update script might fail.
If the Filtered Index still cause errors, you can use the attached RemoveFilteredIndexes.sql script to undo the filtered indexes.
With use of the Exact System Information Tool you can easily add filtered indexes to your Exact databases. On the tab SQL Maintenance you need to select the database and click on the Implement button in the 'Filtered Indexes and Fill Factor' section.