Category: Indexing

Partitioned Tables Cause Longer Plan Compilation Times.

Folks sometimes ask me, "When a table has more indexes, and SQL Server has more decisions to make, does that slow down execution plan generation?"

Well, maybe, but the table design choice that really screws you on compilation time is partitioning. If you choose to partition your tables, even tiny simple queries can cause dramatically higher CPU times. Even worse, as the famous philosopher once said, "Mo partitions, mo problems."

Read more about Partitioned Tables Cause Longer Plan Compilation Times. 12 comments — Join the discussion
Production DBA

Free Webcast: Help! My SQL Server Maintenance is Taking Too Long!

You manage growing SQL Server databases with shrinking nightly maintenance windows. You just don't have enough time left each night to do the necessary backups, corruption checking, index maintenance, and data jobs that your users and apps want to run. Cloud storage isn't helping the problem, either.

Stop playing Tetris with your job schedules and step back for a second: are we doing the right things, at the right times, with the right SQL Server configuration?

Read more about Free Webcast: Help! My SQL Server Maintenance is Taking Too Long! 4 comments — Join the discussion
Performance Tuning

When Do I Need to Use DESC in Indexes?

If I take the Users table from any Stack Overflow database, put an index on Reputation, and write a query to find the top 100 users sorted by reputation, descending:
[crayon-6a61d5a5dab36757305222/]
It doesn't matter whether the index is sorted ascending or descending. SQL Server goes to the end of the index and starts scanning backwards:

Read more about When Do I Need to Use DESC in Indexes? 4 comments — Join the discussion

Want to use columnstore indexes? Take the ColumnScore test.

When columnstore indexes first came out in SQL Server 2012, they didn't get a lot of adoption. Adding a columnstore index made your entire table read-only. I often talk about how indexing is a tradeoff between fast reads and slow writes, but not a lot of folks can make their writes quite that slow. Thankfully, Microsoft…

Read more about Want to use columnstore indexes? Take the ColumnScore test. 27 comments — Join the discussion

Announcing a New Class: Fundamentals of Columnstore

Your report queries are too slow. Will columnstore indexes help?

You’ve tried throwing some hardware at it: your production SQL Server has 12 CPU cores or more, 128GB RAM, and SQL Server 2016 or newer. It’s still not enough to handle your growing data. It’s already up over 250GB, and they’re not letting you purge old data.

Read more about Announcing a New Class: Fundamentals of Columnstore 4 comments — Join the discussion
Performance Tuning

Free Webcast Wednesday: Pushing the Envelope with Indexing for Edge Case Performance

Most of the time, conventional clustered and non-clustered indexes work just fine – but not all the time. When you really need to push performance, hand-crafted special index types can give you an amazing boost. Join Microsoft Certified Master, Brent Ozar, to learn the right use cases for filtered indexes, indexed views, computed columns, table partitioning and more.

Read more about Free Webcast Wednesday: Pushing the Envelope with Indexing for Edge Case Performance 15 comments — Join the discussion
Performance Tuning

[Video] How to Think Like Clippy (Subtitle: Watch Brent Wear Another Costume)

Remember Clippy, the Microsoft Office assistant from the late 1990s? He would pop up at the slightest provocation and offer to help you do something - usually completely unrelated to the task you were trying to accomplish. Sadly, the Office team told Clippy that he didn't make the stack rankings cut, so he relocated over…

Read more about [Video] How to Think Like Clippy (Subtitle: Watch Brent Wear Another Costume) 3 comments — Join the discussion
Performance Tuning

No, You Can’t Calculate the Tipping Point with Simple Percentages.

This morning, Greg Gonzalez (who I respect) posted about visualizing the tipping point with Plan Explorer (a product I respect), and he wrote: The tipping point is the threshold at which a query plan will "tip" from seeking a non-covering nonclustered index to scanning the clustered index or heap. The basic formula is: A clustered…

Read more about No, You Can’t Calculate the Tipping Point with Simple Percentages. 21 comments — Join the discussion
T-SQL & Development

If You Have Foreign Keys, Don’t Update Fields That Aren’t Changing.

If you update a row without actually changing its contents, does it still hurt?

Paul White wrote in detail about the impact of non-updating updates, proving that SQL Server works hard to avoid doing extra work where it can. That's a great post, and you should read it.

Read more about If You Have Foreign Keys, Don’t Update Fields That Aren’t Changing. 25 comments — Join the discussion
Performance Tuning

Why Ordering Isn’t Guaranteed Without an ORDER BY

If your query doesn't have an ORDER BY clause,
you can't reliably predict the order of your results over time.

Sure, it's going to look predictable at first, but down the road, as things change - the indexes, the table, the server's configuration, the size of your data - you can end up with some ugly surprises.

Read more about Why Ordering Isn’t Guaranteed Without an ORDER BY 10 comments — Join the discussion

[Video] What Percent Complete Is That Index Build?

SQL Server 2017 & newer have a new DMV, sys.index_resumable_operations, that show you the percent_completion for index creations and rebuilds. It works, but...only if the data isn't changing. But of course your data is changing - that's the whole point of doing these operations as resumable. If they weren't changing, we could just let the operations finish.

Read more about [Video] What Percent Complete Is That Index Build? 6 comments — Join the discussion
Performance Tuning

Things to Consider When SQL Server Asks for an Index

One of the things I love about SQL Server is that during query plan compilation, it takes a moment to consider whether an index would help the query you're running. Regular blog readers will know that I make a lot of jokes about the quality of these recommendations - they're often incredibly bad - but even bad suggestions can be useful if you examine 'em more closely.

Read more about Things to Consider When SQL Server Asks for an Index Be the first to comment