Posts Tagged ‘statistics’

A quick example of why IN can be bad

Warning: count(): Parameter must be an array or an object that implements Countable in /home/fbsqlcom/public_html/ on line 31

Here’s just a quick demo that illustrates why the IN operator in TSQL might not perform as well as alternatives (like a range query or joining onto a temporary table containing your values). ?View Code TSQLIF OBJECT_ID(’tempdb..#temp’) IS NOT NULL BEGIN DROP TABLE #temp; END;   CREATE TABLE #temp ( id INTEGER NOT NULL IDENTITY(1,1), […]

The difference statistics can make

A few days ago a developer came to me with a query that was executing slowly on a staging server. On this server it took 16 long seconds to execute while on other servers it took about 1 second. I did a quick schema compare and found them to be identical. So I ran the […]