Query-Performance

Category: query-performance

Bug: Incorrect modification_counter for Column Stats on Tables with a Clustered Columnstore Index

Bug: Incorrect modification_counter for Column Stats on Tables with a Clustered Columnstore Index

I don’t find bugs in SQL Server all that often. I find bugs in my own code all the time.

In this case I double checked, and I think it’s a real SQL Server bug.

Continue reading

How to Query Histogram Target XML in Extended Events

How to Query Histogram Target XML in Extended Events

on January 12, 2017

When I was recently testing tempdb file usage, I used an Extended Events session that used SQL Server’s histogram target to track sqlserver.file_read events in the tempdb database for a specific session.

Continue reading

Parallelism and tempdb data file usage in SQL Server

Parallelism and tempdb data file usage in SQL Server

on January 3, 2017

I’m sometimes asked if the number of CPU cores used by a query determines the number of tempdb files that the query can use.

Good news: even a single threaded query can use multiple tempdb data files.

Continue reading

Columnstore Indexes and Computed Columns in SQL Server 2016

Columnstore Indexes and Computed Columns in SQL Server 2016

You can’t do everything with a columnstore index – but SQL Server’s optimizer can get pretty creative so it can use a columnstore index in ways you might not expect.

Continue reading

Actual Time Statistics in Execution Plans: Elapsed CPU Time and more

Actual Time Statistics in Execution Plans: Elapsed CPU Time and more

One of the coolest things to come to SQL Server Management Studio in a long time might be hard to see at first: it’s tucked away in the Properties Window.

But once you see it, it might just be something that you use all the time.

Continue reading

Index Create and Last Modified Dates in SQL Server

Index Create and Last Modified Dates in SQL Server

In many environments, it’s useful to know exactly when an index was created or modified.

Did that last code release help performance, or hurt it? It’s really helpful to know exactly when the code was deployed to prove that your change made something better. Or that you might need to roll it back.

It takes a little preparation to track changes to your indexes, but it’s easy to implement.

Continue reading

Does Truncate Table Reset Statistics?

Does Truncate Table Reset Statistics?

Short answer: the SQL Server optimizer will know that the table was truncated, but statistics might not update when you expect.

For the long answer, let’s walk through an example using the WideWorldImporters sample database.

Continue reading