Interpreting DMV’s & practical uses

25
Interpreting DMV’s & practical uses Jannie Muller mullerjannie.wordpress.com

description

Interpreting DMV’s & practical uses. Jannie Muller mullerjannie.wordpress.com. Making sense of – Dynamic Manage Views. And other practical DBA stuff!. Troubleshooting Timeline “Wh ere do we start ?!”. “ sys.configurations VS. sp_configure .”. sys.configurations Degree of parallelism - PowerPoint PPT Presentation

Transcript of Interpreting DMV’s & practical uses

Page 1: Interpreting DMV’s  &  practical  uses

Interpreting DMV’s & practical uses

Jannie Mullermullerjannie.wordpress.com

Page 2: Interpreting DMV’s  &  practical  uses

wellington.sqlpass.org

Page 3: Interpreting DMV’s  &  practical  uses

Making sense of – Dynamic Manage ViewsAnd other practical DBA stuff!

Page 4: Interpreting DMV’s  &  practical  uses

Troubleshooting Timeline“Where do we start ?!”

sys.

config

uratio

ns

sys.

dm_o

s_m

emory

_cle

rks

sys.

dm_e

xec_

reques

ts

sys.

dm_d

b_index

_oper

atio

nal_s

tats

sys.

dm_o

s_buffe

r_des

crip

tors

“Simple. From left to right … right ?”

wellington.sqlpass.org

Page 5: Interpreting DMV’s  &  practical  uses

“sys.configurations VS. sp_configure.”

o sys.configurations

o Degree of parallelismo Server memoryo Query memoryo Full text crawl bandwitho CPU affinityo Fillfactor

Page 6: Interpreting DMV’s  &  practical  uses

“sys.configurations VS. sp_configure.”

Hard affinity.

No affinity.

Page 7: Interpreting DMV’s  &  practical  uses

“sys.dm_os_sys_info and sys.dm_os_memory_Clerks”

o sys.dm_os_sys_info

o Number of CPUs(cpu count)o Hyperthreading ratioo System Memoryo Restart dateo Affinity (scheduler count)

o sys.dm_os_memory_clerks

o NUMA Nodes

Page 8: Interpreting DMV’s  &  practical  uses

“sys.dm_os_buffer_descriptors”

o sys.dm_os_buffer_descriptors

o Row per item in the buffer pool.o Page types.

Page 9: Interpreting DMV’s  &  practical  uses

Troubleshooting Timeline“Where do we start ?!”

sys.

config

uratio

ns

sys.

dm_o

s_m

emory

_cle

rks

sys.

dm_e

xec_

reques

ts

sys.

dm_d

b_index

_oper

atio

nal_s

tats

sys.

dm_o

s_buffe

r_des

crip

tors

“Know your system… backwards, inside out.”

sys.configurationssys.dm_os_sys_infosys.dm_os_memory_clerks

wellington.sqlpass.org

Page 10: Interpreting DMV’s  &  practical  uses

Sp_who2

o sp_who2 ‘active’

o Active requestso Blockingo NUMAo Server start dateo Long running processes

o Log, mirror, jobs,brokero Gauge workload

o Checkpointso Status

o Runnable\waitingo Fulltexto System threads

Page 11: Interpreting DMV’s  &  practical  uses

select 100.*sum(signal_wait_time_ms)/sum(wait_time_ms),100.*sum(wait_time_ms -signal_wait_time_ms)/sum(wait_time_ms)

from sys.dm_os_wait_stats -- resource & CPU waits.

“sys.dm_os_wait_stats and sys.dm_os_waiting_tasks”

o sys.dm_os_wait_stats

o Historicalo Overall wait typeso Filter on typeso Resource waitso Signal (CPU waits)

o sys.dm_os_waiting_tasks

o Currento Who is blockingo What is it blocking ono Activityo Bottlenecks

Page 12: Interpreting DMV’s  &  practical  uses

select 100.*sum(signal_wait_time_ms)/sum(wait_time_ms),100.*sum(wait_time_ms -signal_wait_time_ms)/sum(wait_time_ms)

from sys.dm_os_wait_stats -- resource & CPU waits.

“sys.os_wait_stats and sys.dm_waiting_tasks”

o sys.dm_os_wait_stats

o Historicalo Overall wait typeso Filter on typeso Resource waitso Signal (CPU waits)

o sys.dm_os_waiting_tasks

o Currento Who is blockingo What is it blocking ono Activityo Bottlenecks

Page 13: Interpreting DMV’s  &  practical  uses

“sys.dm_exec_requests and sys.dm_exec_query_stats” o sys.dm_exec_query_stats

o Historicalo Logical \ Physical reads(IO)o Total worker time (CPU)o Execution Counto Text handle.

o sys.dm_exec_requests

o Currento Who is executingo What is it blocking ono Activityo Text Handleo read \ writes \ cpuo Percentage completeo Schedulerso Wait types

Page 14: Interpreting DMV’s  &  practical  uses

“sys.exec_requests and sys.dm_exec_query_stats”

o sys.dm_exec_query_stats

o Historicalo Logical \ Physical reads(IO)o Total worker time (CPU)o Execution Counto Text handle.

o sys.dm_exec_requests

o Currento Who is executingo What is it blocking ono Activityo Text Handle

Page 15: Interpreting DMV’s  &  practical  uses

“sys.dm_exec_query_stats” When it works, it works well…

..that issue on a Friday afternoon just before Beer’o clock.

Page 16: Interpreting DMV’s  &  practical  uses

Butterfly effect… Table details: 200mb, 600k rows.

@ 200 executions per second, it makes a difference.

Page 17: Interpreting DMV’s  &  practical  uses

“sp_recompile” - The solution

Page 18: Interpreting DMV’s  &  practical  uses

Troubleshooting Timeline“Where do we start ?!”

sys.

config

uratio

ns

sys.

dm_o

s_m

emory

_cle

rks

sys.

dm_e

xec_

reques

ts

sys.

dm_d

b_index

_oper

atio

nal_s

tats

sys.

dm_o

s_buffe

r_des

crip

tors

“Know your workload… and the hardware threshold”

sys.dm_os_wait_stats.sys.dm_os_waiting_taskssys.dm_exec_requestssys.dm_exec_query_stats

wellington.sqlpass.org

Page 19: Interpreting DMV’s  &  practical  uses

“sys.dm_io_virtual_file_stats”

SQL VS. Excel

o Cumulativeo read \ Write waits.o Data Vs. log file.

Page 20: Interpreting DMV’s  &  practical  uses

o sys.dm_db_index_usage_stats

o Historicalo Seeko Scano Lookupo Updateo Last used date

o sys.dm_db_index_operational_stats

o Waits or latcheso Range or singleton lookup

o sys.dm_db_index_physical_stats

o Fragmentationo Size

“You can use sys.dm_db_index_operational_stats to track the length of time that users must wait to read or write to a table, index, or partition, and identify the tables or indexes that are encountering significant I/O activity or

hot spots.” - BOL

“sys.dm_db_index_usage_stats , sys.dm_db_index_operational_stats , sys.dm_db_index_physical_stats”

Page 21: Interpreting DMV’s  &  practical  uses

“sys.dm_db_index_usage_stats , sys.dm_db_index_operational_stats , sys.dm_db_index_physical_stats”

o sys.dm_db_index_usage_stats

o Historicalo Seeko Scano Lookupo Updateo Last used date

o sys.dm_db_index_operational_stats

o Waits or latcheso Range or singleton lookup

o sys.dm_db_index_physical_stats

o Fragmentationo Size

Page 22: Interpreting DMV’s  &  practical  uses

“sys.dm_db_index_usage_stats , sys.dm_db_index_operational_stats , sys.dm_db_index_physical_stats”

o sys.dm_db_index_usage_stats

o Historicalo Seeko Scano Lookupo Updateo Last used date

o sys.dm_db_index_operational_stats

o Waits or latcheso Range or singleton lookup

o sys.dm_db_index_physical_stats

o Fragmentationo Size

Page 23: Interpreting DMV’s  &  practical  uses

“sys.dm_db_index_usage_stats , sys.dm_db_index_operational_stats , sys.dm_db_index_physical_stats”

o sys.dm_db_index_usage_stats

o Historicalo Seeko Scano Lookupo Updateo Last used date

o sys.dm_db_index_operational_stats

o Waits or latcheso Range or singleton lookup

o sys.dm_db_index_physical_stats

o Fragmentationo Size

“The value for avg_fragmentation_in_percent should be as close to zero as possible for maximum performance. However, values from 0 percent through 10 percent may be

acceptable. All methods of reducing fragmentation, such as rebuilding, reorganizing, or re-creating, can be used to reduce these values. “ - BOL

Page 24: Interpreting DMV’s  &  practical  uses

Troubleshooting Timeline“Where do we start ?!”

sys.

config

uratio

ns

sys.

dm_o

s_m

emory

_cle

rks

sys.

dm_e

xec_

reques

ts

sys.

dm_d

b_index

_oper

atio

nal_s

tats

sys.

dm_o

s_buffe

r_des

crip

tors

“Simple. From left to right … right ?”

Set yourself goals to spend limited time on a DMV.

Just because it’s not in SQL doesn’t mean you can’t use it.

Combine your DMV information with data from Win 2008 resource monitor. Use excel to visualize your data. Don’t forget to all the tools available to you.

Most importantly don’t forgot sp_who2.

Page 25: Interpreting DMV’s  &  practical  uses

Thanks! Questions?

Please complete an evaluation form for this session…and thanks again to our awesome sponsors!