The DMV sys.dm_exec_query_optimizer_info keeps statistics of optimizer activity. My simple query shows optimizations, elapsed time, final cost and more.
SQL SERVER – Copy Statistics from One Server to Another Server
Without the client’s data, every query ran in zero milliseconds. Here is how I copy statistics from one server to another to tune with only the schema.
Unused Index Script: Find Indexes That Only Cost You Writes
This Unused Index Script lists nonclustered indexes that SQL Server keeps writing to and no query ever reads. It starts from the index list so untouched indexes are not missed, skips the risky ones, and writes the disable and recreate statements. A garden center orders table shows one update dropping from 5,011 pages to 6 once an unused index is disabled.
Missing Index Script: Read the Suggestions Before You Create
This Missing Index Script ranks the indexes SQL Server wishes it had by a plain score and builds a CREATE INDEX statement for each. Read the key order, the INCLUDE list and the overlap before you create one. A garden center orders table shows the logical reads drop from 3,138 pages to 3.
SQL SERVER – Reduce the Virtual Log Files (VLFs) from LDF file
Too many virtual log files are bad for your LDF. Here is a simple script to reduce the virtual log files right away with a log backup and a shrink.
Fiscal Years That Do Not Start in January
Compute fiscal years and quarters from an April start, build indexed date boundaries, and store a fiscal calendar for repeatable reports.
SQL SERVER – Detect Virtual Log Files (VLF) in LDF
A large LDF file is made of many small Virtual Log Files (VLFs). Here is how to detect them with DBCC LOGINFO and see which ones are active.






