-
Think twice before using table variables
T-SQL Tuesday For T-SQL Tuesday this month Raul Gonzalez has asked us all to blog about lessons learnt the hard way: http://www.sqldoubleg.com/2017/07/03/tsql2sday-92-lessons-learned-the-hard-way/ My biggest sins have been executing code against production environments when I thought I was pointing at my local machine: DELETE FROM dbo.Blah; DROP DATABASE Blah; I’ve learned from those experiences – mostly… Read more
-
When do Distribution Statistics Get Updated?
An updated version of this post can be found here. Statistics objects are important to us for allowing SQL to make good estimates of the row-counts involved in different parts of a given query and to allow the SQL Optimiser to form efficient execution plans to delivery those query results. Statistics get updated automatically when… Read more
-
Row-count Estimates when there are no Statistics
When you don’t have statistics, what does SQL use to calculate the estimated number of rows? Read more
-
Statistics and Cardinality Estimation
There is an updated version of this post here. Cardinality This is a term originally from Mathematics, generally defined as “The number of objects in a given set or grouping”. In SQL we’re continually dealing with sets so this becomes a very relevant topic, which in our context is just the “number of rows”. When… Read more
-
What’s an “Index” and how do they work?
What is an index, and how are they used in practice to speed up query performance. Read more
-
SQL Puzzle 1: Magic Squares
First in a series of recreational puzzles you can solve using SQL. Read more