concept nonclustere index in category sql

appears as: nonclustered indexes, nonclustered indexes, nonclustered index, nonclustered index
SQL Server MVP Deep Dives

This is an excerpt from Manning's book SQL Server MVP Deep Dives.

The reason for this is straightforward. The query optimizer examines the effects that the JOIN might have. When it sees that none apply (the only one that had applied was additional columns; ignoring the SubcatName column removes that one too), it realizes that the JOIN is not being used and treats the query as if the JOIN were not there at all. Furthermore, if we were not querying the Color column (as shown in figure 3), the query could take advantage of one of the nonclustered indexes on the Product table, as if we were querying the table directly.

The practice of compressing database backups has emerged over recent years to address these problems, but another opportunity still remains that can further reduce backup time, space, and energy consumption—simply by eliminating index data from backups! Because the proportion of data consumed by nonclustered indexes is significant in many databases (often 50 percent or greater), the savings to be made from eliminating these indexes from backups is also significant in many cases.

The @NCIXFGName parameter should be provided with the name of a new filegroup to rebuild nonclustered indexes into. At this stage, this filegroup does not exist, but we’ll create it in step 7. The name provided for this new filegroup must be different from the existing nonclustered index filegroup for this database (which is NCIX_FG in our example) because that filegroup’s descriptive metadata still exists in the system catalogs. For our example, we’ll create another filegroup named N’NCIX_FG2’.

EXEC usp_Manage_NCIX_FileGroup N'Script', N'NCIX_FG2'

Output from the execution of this procedure should contain a list of CREATE INDEX statements, one per nonclustered index in the database. Save this output to a script file (for example NCIXScripts.sql) for later use in step 7. Note that each CREATE INDEX statement will include the filegroup name NCIX_FG2. When we run this script later, nonclustered indexes will be re-created within this filegroup, so we’ll need to add it to the database (which we do in step 7).

Figure 3. Query plan that uses the nonclustered index