Trivially Yours
Going Further
If this is the kind of SQL Server stuff you love learning about, you’ll love my training. I’m offering a 75% discount to my blog readers if you click from here. I’m also available for consulting if you just don’t have time for that and need to solve performance problems quickly.
Related Posts
- The SQL Server Performance Tasting Menu: Performance Issues With Parallel Query Plans
- The SQL Server Performance Tasting Menu: How DISTINCT Queries Can Hurt Performance
- The SQL Server Performance Tasting Menu: How You Compare Date Columns Can Hurt Query Performance
- The SQL Server Performance Tasting Menu: How Multi-Statement Table Valued Functions Hurt Performance
It’s interesting that for a “SELECT COUNT(*) FROM table” query, SQL Server will use a TRIVIAL optimization level, even though it still has to make a decision. It has to decide which of the indexes on the table to scan – either the clustered index or one of many possible nonclustered indexes.
Sure, but as far as costing decisions go, you’re still maintaining the same plan shape, so it’s more a matter of picking the “smallest” index to read from. I’d consider that a trivial decision compared to other stuff.