Query-Performance

Category: query-performance

Can I Force A Hinted Plan with Query Store in SQL Server 2016?

Can I Force A Hinted Plan with Query Store in SQL Server 2016?

SQL Server 2016’s Query Store feature promises to be better than Plan Guides ever were. The Query Store lets  you track query performance, collect execution plans, and force a specific plan if you notice that a query is sometimes fast, and sometimes slow.

Continue reading

NO_PLAN and NO_INDEX: Breaking a Forced Query Store Plan

NO_PLAN and NO_INDEX: Breaking a Forced Query Store Plan

Whenever you’ve got a new feature, one of the first things to ask is, “What happens when I break it?”

Because we’re going to break stuff.

Continue reading

3 Tricks with STATISTICS IO and STATISTICS TIME in SQL Server

3 Tricks with STATISTICS IO and STATISTICS TIME in SQL Server

When  you need to measure how long a query takes and how many resources it uses, STATISTICS TIME and STATISTICS IO are great tools for interactive testing in SQL Server. I use these settings constantly when tuning indexes and query.

Continue reading

Learn Indexing from Kendra in Huntington Beach on April 1 for $99!

Learn Indexing from Kendra in Huntington Beach on April 1 for $99!

on March 18, 2016

It’s just two weeks until I’ll be teaching index tuning in Huntington Beach, California.

This day long session is $99 – and it’s a great time of year to plan a quick visit to California, no?

Continue reading

Live Query Statistics Do Not Replace Actual Execution Plans

Live Query Statistics Do Not Replace Actual Execution Plans

I like SQL Server’s new Live Query Statistics feature a lot for testing and tuning large queries. One of my first questions was whether this could replace using actual execution plans, or if it’s useful to use both during testing.

Finding: Both are useful. And both can impact query performance.

Continue reading

The Case of DATETIME2 and Partition Elimination

The Case of DATETIME2 and Partition Elimination

on March 10, 2016

Data types are hard.

I’ve been working on some demo code for table partitioning. I have a table partitioned by a column named FakeBirthDateStamp, which is a DATETIME2(0) column. The table is a partitioned heap. At this point in the demo, I hadn’t built any indexes. I wanted to show that partition elimination could occur on a partitioned table, even without a clustered index.

Continue reading

What Resets sys.dm_db_index_usage_stats and Missing Index DMVs?

What Resets sys.dm_db_index_usage_stats and Missing Index DMVs?

Managing indexes got trickier with SQL Server 2012. SQL Server has tracked and reported statistics on how often indexes are used and requested since SQL Server 2005. As of SQL Server 2012, suddenly all that information started getting reset whenever anyone ran ALTER INDEX REBUILD.

Continue reading