Healthy SQL Marlon Ramos Premiere Field Engineer - Development Microsoft @mramosgt
Patrocinadores del SQL Saturday Gold Sponsor Bronze Sponsor Geek Sponsor
Agenda What a SQL Server health check is about Why you want to perform a SQL Server health check When you should perform a SQL Server health check Which tools you should use to perform a SQL Server health check
What Is Healthy SQL? A SQL Server health check is simply a routine SQL Server performance assessment and review. You can also refer to this process as a performance audit or analysis.
Why Perform a Health Check? Performance Security Stability Audits Migration Upgrade Backup and restore Business continuity
When to Perform a Health Check? It s a process you want to do regularly New Job as DBA? You are coming in as Consultant Before getting into doomsday scenarios
Steps in a Health Check Collect (via the checklist) Baseline Compare/delta Identify any health issues Establish best practices Determine changes/implement in production Rinse/repeat Implement Changes Define Metrics Create/Modify Baseline Compare Deltas Identify Issues Test Changes Resolutions
What to Collect? Memory Usage Server Info CPU Usage System Errors Configuration I/O Activity Disk Space SQL Backup Info Get the FACTS 15-Point Health Check Top Server Waits Blocking Index Stats Top Costly Queries SQL Job History Security Database Info
Road Map Essentials Inventory Statistical terms: baseline, delta, deviation, an so on Metadata Collection data Compare data Performance life cycle Testing life cycle Best practices Documentation Run book
Waits and Queues Whenever a request is made within SQL Server that for one of many reasons can t be immediately satisfied, the system puts the request into a wait state. The SQL Server engine internally tracks the time spent waiting, aggregates it at the instance level, and retains it in memory
Wait Type Categories Category Resource waits Signal waits Queue waits External waits Details Locks, latches, memory, network, I/O Time spent waiting for CPU Idle workers, background tasks Extended procs (XPs), linked server queries
Execution Model
Execution Model
CPU Pressure CPU High number of SOS_SCHEDULER_YIELDS waits High percentage of signal waits over resource waits Runnable task counts greater than zero Counters
I/O Pressure Fragmentation I/O Latch Buffer Issues
Memory Pressure Memory grants pendind Memory grants outstanding Blocking
Indexes Advantages Reduces disk I/O Improve query performance (faster Selects/reads) Scan smaller range of data (index) vs. a large one (table scan) Provides efficient data retrieval operations Disadvantages Slow inserts, updates, and deletes Reorganization of rows Too many indexes Page splits Fragmentation
Tools SQL PowerDoc PAL SQL Server Best Practices Analyzer SQL IO
Best Practices The Disk Layout for SQL Server should ideally separate Data, Log, tempdb, Binaries, and SQL Backups to separate physical disks. You should consider enabling LockPagesInMemory for both physical and clustered SQL Servers. Enable Instant File Initialization by assigning the Perform Volume Maintenance Tasks Windows policy to the SQL Server service account. Always set the SQL Server configuration options Maximum Server Memory andminimum Server Memory. Exclude all data, log, backup, and SQL Server files from antivirus scans. The rule of thumb for the number of Tempdb Files to create for a SQL Server is the number of Logical Cores/4. Use the Startup Trace Flag T-1118 to reduce allocation contention in the SQL Server tempdb database. Enable the SQL Server configuration setting Optimize For AdHoc Workloads for better query performance. Increase the SQL Server configuration setting Cost Threshold for Parallelism to specify the threshold at which SQL Server creates and runs parallel plans for queries. Consider using native backup compression for your SQL Server backups.
PREGUNTAS Y RESPUESTAS marlon.ramos@outlook.com http://marlonramos.blogspot.com Marlon Ramos @mramosgt
Evaluaciones Evaluacion del evento http://www.sqlsaturday.com/443/eventeval.aspx Evaluacion de las charlas http://www.sqlsaturday.com/443/sessions/sessionevaluation.aspx
Proxima sesion Dr Rudo & Dave Rndn: Mejores practicas para Admin de SQL y Azure