Posts tagged Indexes
List of tables and indexes, with associated File Group
01 year ago
in Transact-SQL
The script below (written using SQL Server 2005), returns a list of all tables (along with the schema name), and indexes (where they exist), and the name of the associated file group.
This will useful to find out which objects have been assigned to the wrong file group.
I have a database with over [...]
Non-clustered indexes
03 years ago
in General
When creating non-clustered indexes, you should never include the clustered index key fields (commonly used for the primary key) as part of the non-clustered index.
This is because the fields will always be used within queries. There is no need to specify them again.
The only exception to this, [...]
Rebuild or Reorganize Indexes?
03 years ago
in General
The query below can be used to identify those indexes that should be rebuilt (using ALTER INDEX REBUILD WITH (ONLINE = ON), or those that should be reorganized (USING ALTER INDEX REORGANIZE):
SELECT object_name(a.object_id) as TableName,
a.index_id,
a.Index_Type_Desc,
b.name AS [...]