MSSQL Indexes

NOTE: Large-scale index operations, whether offline or online, can cause the transaction log to fill quickly. The transaction log cannot be truncated until the index operation has been completed but the transaction log can be backed up during the index operation.

Clustered vs Non-Clustered

Is Index Fragmentation Important?

TL;DR Possibly not.

Is My Index cached?


TODO

Rebuild vs Reorganize

NOTE: This is the same decision as Rebuild vs Coalesce for Oracle

In SQL2012 and SQL2014, parallel online index rebuilds can cause corruption.

https://sqlperformance.com/2014/06/sql-indexes/hotfix-sql-2012-rebuilds

Online vs Offline Index Builds/Rebuilds

OFFLINE

ONLINE

An antimatter column is used to track possible conflicts between the updates and the rebuild (e.g. delete of a row which was not yet copied).

Index Creation Progress

Bibliography & References

https://www.brentozar.com/archive/2013/09/index-maintenance-sql-server-rebuild-reorganize/https://www.brentozar.com/archive/2012/08/sql-server-index-fragmentation/https://sqlperformance.com/2014/06/sql-indexes/hotfix-sql-2012-rebuildshttps://ola.hallengren.com/https://sqlperformance.com/2017/12/sql-indexes/impact-fragmentation-planshttps://www.brentozar.com/archive/2012/08/sql-server-index-fragmentation/https://www.brentozar.com/archive/2019/08/dba-training-plan-10-managing-index-fragmentation/ https://www.brentozar.com/archive/2017/12/index-maintenance-madness/https://www.brentozar.com/archive/2013/10/how-much-is-offline-during-an-index-rebuild/https://www.brentozar.com/archive/2017/12/whats-bad-shrinking-databases-dbcc-shrinkdatabase/
https://www.mssqltips.com/sqlservertip/2261/sql-server-fragmentation-storage-basics-and-access-methods-part-1-of-9/https://www.mssqltips.com/sqlservertip/2262/sql-server-fragmentation-what-it-is-what-types-there-are-part-2-of-9/https://www.mssqltips.com/sqlservertip/2263/sql-server-fragmentation-what-causes-it-part-3-of-9/https://www.mssqltips.com/sqlservertip/2264/sql-server-fragmentation-how-to-avoid-it-part-4-of-9/(1,2,3) https://www.mssqltips.com/sqlservertip/2265/sql-server-fragmentation-what-it-impacts-and-what-it-does-not-part-5-of-9/https://www.mssqltips.com/sqlservertip/2266/sql-server-fragmentation-how-to-detect-it-part-6-of-9/https://www.mssqltips.com/sqlservertip/2267/sql-server-fragmentation-custom-detection-procedure-page-linkage-part-7(4) https://www.mssqltips.com/sqlservertip/2268/sql-server-fragmentation-how-to-address-it-part-8-of-9/https://www.mssqltips.com/sqlservertip/2269/sql-server-fragmentation-hands-on-experience-part-9-of-9/
https://www.mssqltips.com/sql-server-tip-category/39/fragmentation-and-index-maintenance/
https://www.sqlservercentral.com/forums/topic/index-maintenance-in-availability-groups
https://dba.stackexchange.com/questions/13140/is-there-a-way-to-force-an-index-to-stay-in-memory-with-sql-server-2008#13143https://www.sqlshack.com/how-to-identify-and-resolve-sql-server-index-fragmentation/ https://stackoverflow.com/questions/6309614/what-is-the-difference-between-offline-and-online-index-rebuild-in-sql-serverhttp://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/OnlineIndex.dochttp://rusanu.com/2011/08/05/online-index-operations-for-indexes-containing-lob-columns/
https://docs.microsoft.com/en-us/sql/relational-databases/indexes/reorganize-and-rebuild-indexes?view=sql-server-2017https://dba.stackexchange.com/questions/139191/sql-server-how-to-track-progress-of-create-index-command/274930#274930
Key Lookupshttps://forrestmcdaniel.com/2020/12/30/an-empirical-look-at-key-lookups/
SQL2019https://learn.microsoft.com/en-us/sql/t-sql/statements/create-index-transact-sql?view=sql-server-ver15