Skip to content

Instantly share code, notes, and snippets.

View evenkiel's full-sized avatar

Steve Scheffler evenkiel

View GitHub Profile
@evenkiel
evenkiel / gist:e218c595f76794dcc022
Created February 12, 2015 22:55
SQL Server Performance Tuning Class - Day 4

SQL Server Performance Tuning Class - Day 4

How to Measure Your Server

  • 3 Key Numbers
    • How busy is your server
    • How hard is it working
    • Ho wmuch data do you have

How Busy is Your Server

  • Perfmon SQLServer:SQL Statistics - Batch Requests/sec. Trend this on an hourly basis and break it out by Weekday/Weekend
@evenkiel
evenkiel / gist:52fb3259eaed51caf735
Created February 11, 2015 23:29
SQL Server Performance Troubleshooting - Day 3 Notes

SQL Server Performance Tuning Class - Day 3

Denver 2015

-- SocietySkins (laptop skins)

Performance Tuning Indexes

  • sp_BlitzIndex
  • If you don't create a clustered index then data is stored in a structure called a 'heap'
  • Usage stats shows you what was in the plan, Op Stats will tell you what was acutally used.
  • A 'scan' isn't necessarily a full scan. You need to look at the actual execution plan to see
@evenkiel
evenkiel / gist:e3c048a6046f6be96d88
Created February 10, 2015 23:30
SQL Server Performance Troubleshooting - Day 2 Notes

SQL Server Performance Tuning Class - Day 2

Denver 2015

Finding Queries and Bottlenecks

  • RECOMPILE hints will cause the sproc to not show up in the DMV (Dynamic Management Views)
  • DMVs and profiler will only catch perf issues for a window of time. They are passive tools that have to be running when the issue occurs
  • sp_Blitz will look across a wider window of time.
  • ClearTrace as scriptable (and more powerful) version of SQL Server Profiler.
  • Recommended practice is to create a Tools database to store scripts like ClearTrace and the BrentOzar scripts. May shops will not allow anything to be installed to master. Plus, master won't be restored typically during a rebuild
@evenkiel
evenkiel / gist:9b939c3ad149d369ff91
Created February 10, 2015 19:56
Performance Links
@evenkiel
evenkiel / gist:a05d3dbdc29b17ac2284
Last active November 9, 2022 19:21
SQL Server Performance Troubleshooting - Class Notes Day 1

SQL Server Performance Tuning Class - Day 1

Denver 2015

Getting ready steps

  • Write down 3 biggest pain points
    • "IS" it the database that's slowing things down or environmental? Is perfmon the answer?
    • Deadlocks / locking. Should we be running in a differnet isolation mode?
    • Audit solution - triggers vs in-app, etc.
  • Gather SQL server stats
  • Gather Wait statistics
@evenkiel
evenkiel / gist:7418675
Created November 11, 2013 19:14
Custom knockout binding handler to work with the Select2 project
//
// Assumes that you are binding to a hidden input element.
//
// Bindings:
// * select2 : passthrough options to the select2 javascript call
// * selectedItem : object to initially select, or null
// * itemMapper : defaaults to {id: 'id', text: 'text'}
// * items : set of items to init the selection list with
//
// example:
@evenkiel
evenkiel / recursive-delete.ps1
Created June 25, 2012 23:53
Powershell function to recursively delete a folder and all of its child folders and files
#
# Given a root directory, perform a depth first recursive delete of all subdirectories and files.
# Necessary b/c for some reason powershell won't always succeed in a recursive delete of folders which contain
# subfolders
#
function RecursiveDelete($theroot) {
$children = Get-ChildItem -Path $theroot | where-object { $_.Attributes -eq "Directory"} |% {$_.FullName}
foreach($achild in $children) {
if ($achild -ne $null) {
RecursiveDelete $achild
@evenkiel
evenkiel / reading-excel-spreadsheets-using-gembox.spreadsheet-from-powershell.ps1
Created March 17, 2012 02:13
Reading Excel spreadhseets using GemBox.Spreadsheet from PowerShell
#
# Example powershell script to read in contents of an Excel XLSX spreadsheet using
# the GemBox.Spreadsheet library (http://www.gemboxsoftware.com/)
#
# NOTE: Since GemBox.Spreadsheet is dependent upon .NET 4.0, and since the powershell 2.0
# tooling is, by default, only .NET 3.5 capable, there's an extra step you need to
# go through to get your environment ready. See the stackoverflow article here
# http://stackoverflow.com/a/5069146
# for more details on how to configure this.
#