Query-Performance

Category: query-performance

Join me at SQLBits for a Day of Index Design and Tuning

Join me at SQLBits for a Day of Index Design and Tuning

on December 30, 2015

Wednesday, May 4, 2016 Liverpool Exhibition Centre One day session* *£349 until April 9, 2016. £399 thereafter – This training day has sold out!

I will be presenting this session in a Training Day at the SQLBits conference in Liverpool, UK. Reserve your seat for this one day session here.

Continue reading

Why Teaching Makes You a Better DBA and Performance Tuner

Why Teaching Makes You a Better DBA and Performance Tuner

on December 29, 2015

I’ve known for a long time now that teaching makes me a better database administrator and performance tuner. But I’ve had a hard time figuring out why.

Continue reading

Joins, Predicates, and Statistics in SQL Server

Joins, Predicates, and Statistics in SQL Server

on December 8, 2015

Joins can be tricky. And where you put your ‘where’ clause may mean more than you think!

Take these two queries from the AdventureWorksDW sample database. The queries are both looking for data where SalesTerritoryCountry = ‘NA’ and they have the same joins, but the first query has a predicate on SalesTerritoryCountry while the second has a predicate on SalesTerritoryKey.

/* Query 1: Predicate on SalesTerritoryCountry */ select ProductKey, OrderDateKey, DueDateKey, ShipDateKey, CustomerKey, PromotionKey, CurrencyKey, fis.SalesTerritoryKey, SalesOrderNumber, SalesOrderLineNumber, RevisionNumber, OrderQuantity, UnitPrice, ExtendedAmount, UnitPriceDiscountPct, DiscountAmount, ProductStandardCost, TotalProductCost, SalesAmount, TaxAmt, Freight, CarrierTrackingNumber, CustomerPONumber, OrderDate, DueDate, ShipDate from dbo.FactInternetSales fis join dbo.DimSalesTerritory st on fis.SalesTerritoryKey=st.SalesTerritoryKey where st.SalesTerritoryCountry = N’NA’ GO

Continue reading

Actual Number of Rows Read in SQL Server Execution Plans

Actual Number of Rows Read in SQL Server Execution Plans

By Kendra Little on December 3, 2015

Execution plans got a cool new piece of diagnostic information in SQL Server 2012 SP3, SQL Server 2014 SP2, and SQL Server 2016: “Number of Rows Read”. In fancy language, this is “better diagnostics” when a query plan has “residual predicate pushdown” (KB 3107397).

Continue reading

Does OPTION (RECOMPILE) Prevent Query Store from Saving an Execution Plan?

Does OPTION (RECOMPILE) Prevent Query Store from Saving an Execution Plan?

on November 25, 2015

Recompile hints have been tough to love in SQL Server for a long time. Sometimes it’s very tempting to use these hints to tell the optimizer to generate a fresh execution plan for a query, but there can be downsides.

Continue reading

Did My Query Eliminate Table Partitions in SQL Server?

Did My Query Eliminate Table Partitions in SQL Server?

Working with table partitioning can be puzzling. Table partitioning isn’t always a slam dunk for performance: heavy testing is needed. But even getting started with the testing can be a bit tricky!

Here’s a (relatively) simple example that walks you through setting up a partitioned table, running a query, and checking if it was able to get partition elimination.

Continue reading

SQL Server Filtered Indexes: The Third Index Dimension

SQL Server Filtered Indexes: The Third Index Dimension

on August 11, 2015

One perk to filtered indexes that may not be obvious at first is that you get an extra “dimension”– almost an extra kind of key column. This can be useful for some queries that can be tricky to index.

Continue reading