sql

SQL Maintenance Plan Optimization

I was investigating a number of maintenance plans that were taking serveral hours to complete and I noticed some optimizations that could be made to the plans without actually affecting the behaviour very much. The maintenance plan after the fixes is: Check Database Integrity Maintenance Cleanup Task Rebuild Index Clean Up History Back Up Database […]

Testing SQL Query Performance

I was asked about how to test a query without all of the clever caching that SQL performs, this is how you do it… but read on for important information. DBCC DROPCLEANBUFFERS DBCC FREEPROCCACHE GO SELECT * FROM MyTable Very Important Notes There are some very important things to consider before you use these commands. […]

Finding Table Sizes in SQL Server

As your database grows, you’ll start becoming highly interested in finding out where your data is. This SQL script grabs a list of tables, with their size (total and used) along with a quick calculation of an average size per row. Just point it at your database and run it to get some numbers out. […]