Category: Indexing

Performance Tuning

Trivial Optimization and Missing Indexes in SQL Server

Recently, Jes asked the team an index tuning question: "If a query has an index hint in it, will the optimizer ever suggest a missing index for that query?"

I immediately loved the question because I'd never really thought about it before. I typically think of index hints as being a very risky game and avoid them whenever I can-- after all if someone drops the index you've hinted, any query hinting a non-existent index will start to fail. (That's a really bad day!)

Read more about Trivial Optimization and Missing Indexes in SQL Server 7 comments — Join the discussion
Performance Tuning

How to Find ‘Secret Columns’ in Nonclustered Indexes

sp_BlitzIndex® just can't keep a secret. That's a feature, not a bug. I wrote sp_BlitzIndex® specifically so that it would rat out some things that SQL Server is doing behind the scenes to secretly help you out-- because it's really better if you know about it. What are secret columns? SQL Server needs a unique…

Read more about How to Find ‘Secret Columns’ in Nonclustered Indexes 21 comments — Join the discussion
Performance Tuning

The Index Your Queries will Never Request (A Clustered Index!)

When it comes to indexes, SQL Server is really helpful. It lets you see what indexes queries are asking for both in execution plans, and missing index dynamic management views ("DMVs"). I like to look at the DMV missing index requests using sp_BlitzIndex®.

When you look at missing index requests, it's always important to remember one of the biggest things: these missing index requests won't ever ask for or recommend a specific clustered index.

Read more about The Index Your Queries will Never Request (A Clustered Index!) 3 comments — Join the discussion
Performance Tuning

What’s Better: Disabling vs. Dropping Indexes?

In order to improve your applications and your databases, they will need to change over time. The structure of the database changes, the structure of the tables change, the data in the tables change, the application changes, the queries against the data change. Indexes that once helped performance now just bloat your database and cause extra work for inserts, updates, and deletes.

Read more about What’s Better: Disabling vs. Dropping Indexes? 52 comments — Join the discussion

Best Practices + Table Partitioning: Merging Boundary Points

One of the many best practices for SQL Server's table partitioning feature is to create "extra" empty partitions around your data. This is explained in SQL Server Books Online in the page on altering a Partition Function: Always keep empty partitions at both ends of the partition range to guarantee that the partition split (before…

Read more about Best Practices + Table Partitioning: Merging Boundary Points Be the first to comment

SQL Server Table Partitioning Tutorial: Videos and Scripts

There's a secret to learning about SQL Server's table partitioning feature: you need to get your hands on some code and really play with it in a test environment.

In this tutorial, Kendra will walk you through test scripts that set up a sample table partitioning environment. These scripts demonstrate gotchas to look out for and the cool features that can dramatically change your database's performance.

Read more about SQL Server Table Partitioning Tutorial: Videos and Scripts 70 comments — Join the discussion

Potential Problems with Partitioning

Getting started with table partitioning is difficult; there are many decisions to make after you've decided to partition data. Correctly configuring partitioning is critical to the long term performance and stability of the database from both a querying and data modification standpoint. There are three key considerations that database architects should devote time to before embarking on a partitioning implementation: the design of the partitioning key, a thorough study of querying practices, and an examination of data modification practices.

Read more about Potential Problems with Partitioning Be the first to comment
Production DBA

Hash Partitioning, SQL Server, and Scaling Writes

At first glance, SQL Server’s partitioning seems like it should be an easy way to solve problems inserting data into busy tables. If the writes are spread across many partitions it only makes sense that we can avoid write hot spots in SQL Server, right? The truth is much more complicated than it appears. Asking…

Read more about Hash Partitioning, SQL Server, and Scaling Writes 18 comments — Join the discussion

How To Decide if You Should Use Table Partitioning

Great volumes have been written about table partitioning. It’s a complex feature and you can read for days to just understand how you might apply it. But will it improve performance for you? Table partitioning produces great benefits for some applications, but causes giant headaches for others.

How do you know if you should invest your time in table partitioning?

Read more about How To Decide if You Should Use Table Partitioning 160 comments — Join the discussion
Performance Tuning

Kendra Little Explains How to Design Smarter Indexes

How do you know which indexes to create to improve your database performance? Microsoft Certified Master Kendra Little shows you how to find a missing index, decide on the best index definition, and measure the usefulness of your new index. If you know the basics of what a database index does and want to learn the smart way to design indexes, this talk is for you.

Read more about Kendra Little Explains How to Design Smarter Indexes 23 comments — Join the discussion

Index Fragmentation Findings: Part 2, Size Matters

Last week, I blogged about the basics of SQL Server index fragmentation: why it happens, how to fix it, and how often people are fixing it.  I left you with a cliffhanger: it seemed that the frequency of defrag jobs didn't appear to affect fragmentation levels:

Databases with no index defragmentation were an average of 5% fragmented
Monthly - 17% fragmented
Weekly - 3% fragmented
Daily - 6% fragmented

Read more about Index Fragmentation Findings: Part 2, Size Matters 11 comments — Join the discussion