Not all stats should be auto-updated

August 29, 2024 Andy 1

Statistics auto-updates are generally a good thing–auto-update of statistics is the default behavior in SQL Server. Having the freshest information about the data “shape” helps to inform the best selection of an execution plan for queries. Except for when it doesn’t. Because It Depends™️ Let’s … [Read More]

What’s the use case of disabling an index?

September 25, 2022 Andy 0

Question I just learned that indexes can be disabled on a table. Even the clustered index can be disabled. After that, users can’t access the index or the data if clustered index. When will we disable an index? I just don’t understand the use case. … [Read More]

When to put a non-clustered index on your clustering key

September 3, 2019 Andy 1

There is a corner case where it makes sense to have a non-clustered index “duplicating” the clustered index. If you have a query that frequently scans the table, and ONLY makes use of the clustering key column, the query optimizer will prefer to use the non-clustered index.

Nonclustered index storage on clustered columnstore

January 6, 2017 Andy 0

Question In SQL Server, a non-unique nonclustered index on a rowstore table incorporates the base object’s bookmark (RID or clustering key) at all levels of the nonclustered index structure. The bookmark is stored as part of the nonclustered index key at all index levels. On … [Read More]

Data Compression: How page compression works

February 22, 2016 Andy 1

SQL Server supports two kinds of data compression on rowstore data. Columnstore compression is for a different day. You can compress heaps, clustered indexes (on both tables and views), and nonclustered indexes (on both tables and views). Compression requirements Data compression is available in SQL … [Read More]

No Picture

Data Compression: How row compression works

February 15, 2016 Andy 3

SQL Server supports two kinds of data compression on rowstore data. Columnstore compression is for a different day. You can compress heaps, clustered indexes (on both tables and views), and nonclustered indexes (on both tables and views). Compression requirements Data compression is available in SQL … [Read More]

No Picture

Data Compression: Costs & benefits

December 29, 2015 Andy 3

SQL Server supports two kinds of data compression on rowstore data. Columnstore compression is for a different day. You can compress heaps, clustered indexes (on both tables and views), and nonclustered indexes (on both tables and views). Compression requirements Data compression is available in SQL … [Read More]

sp_get_basetable_list

May 22, 2014 Andy 0

At work, we make extensive use of views & synonyms. The reasons are complex (and fodder for another post), but here’s a simplified example: Pricing data is updated multiple times per day, and we want to keep multiple generations of the pricing table online. By … [Read More]