Indexing and Statistics

Designing, evaluating, maintaining, and troubleshooting indexes and statistics.

568 associated posts270 primary posts

SQL Server 2016 Maintenance Plan Improvements

Let's just get one thing out of the way first.

Yes, I understand that you, dear reader, probably hate maintenance plans. You associate them with everything dumb that you did early on in your career, like setting up a single plan that reorganized indexes, then rebuilt them, then updated their statistics. You are older and wiser now, and you swear by tools like Ola Hallengren's maintenance scripts or Minion Reindex.

Read more about SQL Server 2016 Maintenance Plan Improvements 12 comments — Join the discussion

Stats Week: Only Updating Statistics With Ola Hallengren’s Scripts

I hate rebuilding indexes
There. I said it. It's not fun. I don't care all that much for reorgs, either. They're less intrusive, but man, that LOB compaction stuff can really be time consuming. What I do like is updating statistics. Doing that can be the kick in the bad plan pants that you need to get things running smoothly again.

Read more about Stats Week: Only Updating Statistics With Ola Hallengren’s Scripts 46 comments — Join the discussion

Why most of you should leave Auto-Update Statistics on

Oh God, he's talking about statistics again Yeah, but this should be less annoying than the other times. And much shorter. You see, I hear grousing. Updating statistics was bringin' us down, man. Harshing our mellow. The statistics would just update, man, and it would take like... Forever, man. Man. But no one would actually…

Read more about Why most of you should leave Auto-Update Statistics on 16 comments — Join the discussion
Performance Tuning

Unique Indexes and Row Modifications: Weird

Confession time This started off with me reading a blurb in the release notes about SQL Server 2016 CTP 3.3. The blurb in question is about statistics. They're so cool! Do they get fragmented? NO! Stop trying to defragment them, you little monkey. Autostats improvements in CTP 3.3 Previously, statistics were automatically recalculated when the…

Read more about Unique Indexes and Row Modifications: Weird 3 comments — Join the discussion

Changes to auto update stats thresholds in SQL Server 2016

TL;DR
As of CTP 3.3, it's the same behavior as Trace Flag 2371, in 2008 R2 SP1 and onward. That basically means that the bigger your table is, the fewer rows need to be modified before an automatic statistics update occurs.
Slightly longer...
The change was announced over here. At first I thought, woah, cool, they thought about this and made big changes. But no, much like Trace Flags 1117 and 1118 being enabled for tempdb, it's just...

Read more about Changes to auto update stats thresholds in SQL Server 2016 11 comments — Join the discussion
T-SQL & Development

Don’t Use Scalar User-Defined Functions in Computed Columns.

Scalar functions in computed columns cause all queries that hit that table to execute serially. But it gets worse!
Scalar functions in computed columns
cause index maintenance to go single-threaded.
If you're running Expensive Edition, index rebuilds can be both online and parallel. That's pretty cool, because it keeps all your gadgets and gizmos mostly available during the whole operation, and the parallel bit usually makes things faster.

Read more about Don’t Use Scalar User-Defined Functions in Computed Columns. 27 comments — Join the discussion
Performance Tuning

Improved diagnostics for query execution plans that involve residual predicate pushdown

I love stuff like this!
Even though it's not on my list of dream features, it's pretty neat. Getting new views into what SQL is doing when queries execute is pretty cool. You can read the short and gory details at the KB here: Improved diagnostics for query execution plans that involve residual predicate pushdown in SQL Server 2012

Read more about Improved diagnostics for query execution plans that involve residual predicate pushdown 6 comments — Join the discussion
Performance Tuning

Filtered Indexes: Just Add Includes

I found a quirky thing recently While playing with filtered indexes, I noticed something odd. By 'playing with' I mean 'calling them horrible names' and 'admiring the way other platforms implemented them'. I sort of wrote about a similar topic in discussing indexing for windowing functions. It turns out that a recent annoyance could also…

Read more about Filtered Indexes: Just Add Includes 30 comments — Join the discussion
Performance Tuning

Trace Flag 2330: Who needs missing index requests?

Hey, remember 2005?
What a great year for... not SQL Server. Mirroring was still a Service Pack away, and there was an issue with spinlock contention on OPT_IDX_STATS or SPL_OPT_IDX_STATS. The KB for it is over here, and it's pretty explicit that the issue was fixed in 2008, and didn't carry over to any later versions. For people still on 2005, you had a Trace Flag: 2330.

Read more about Trace Flag 2330: Who needs missing index requests? 7 comments — Join the discussion
Performance Tuning

Does Creating an Indexed View Require Exclusive Locks on an Underlying Table?

An interesting question came up in our SQL Server Performance Tuning course in Chicago: when creating an indexed view, does it require an exclusive lock on the underlying table or tables? Let's test it out with a simple indexed view run against a non-production environment. (AKA, a VM on my laptop running SQL Server 2014.)…

Read more about Does Creating an Indexed View Require Exclusive Locks on an Underlying Table? Be the first to comment