DBAtlas · Atlas de operações de banco de dados

Ver os principais wait events

Oracle

SELECT event, total_waits, time_waited, ROUND(time_waited/100,2) AS sec_waited
FROM v$system_event
WHERE wait_class <> 'Idle'
ORDER BY time_waited DESC
FETCH FIRST 20 ROWS ONLY;
-- For real-time analysis: v$active_session_history (ASH)

v$system_event fornece os wait events acumulados; v$active_session_history fornece a amostragem de sessões ativas dos últimos minutos (requer a licença Diagnostics Pack).

PostgreSQL

SELECT wait_event_type, wait_event, count(*)
FROM pg_stat_activity
WHERE wait_event IS NOT NULL AND state = 'active'
GROUP BY 1, 2
ORDER BY 3 DESC;

pg_stat_activity mostra o estado de espera atual; amostrá-lo repetidamente (polling) revela os wait events mais frequentes.

MySQL

SELECT event_name, count_star, sum_timer_wait,
       ROUND(sum_timer_wait/1000000000000, 2) AS sec_waited
FROM performance_schema.events_waits_summary_global_by_event_name
WHERE count_star > 0
ORDER BY sum_timer_wait DESC
LIMIT 20;

events_waits_summary_global_by_event_name fornece os tempos totais de espera por evento (em picossegundos); os instrumentos de wait devem estar habilitados.

SQL Server

SELECT wait_type, waiting_tasks_count, wait_time_ms,
       signal_wait_time_ms, wait_time_ms - signal_wait_time_ms AS resource_wait_ms
FROM sys.dm_os_wait_stats
WHERE wait_time_ms > 0
ORDER BY wait_time_ms DESC;

sys.dm_os_wait_stats mostra os wait types acumulados desde o início da instância; pode ser zerado com DBCC SQLPERF.

MongoDB

db.serverStatus().wiredTiger.concurrentTransactions
// For general waits/congestion:
// db.serverStatus().globalLock  and  db.serverStatus().wiredTiger.cache

O WiredTiger não tem wait events clássicos; o esgotamento de concurrentTransactions (tickets), globalLock.currentQueue e a pressão no cache indicam congestionamento.

Redis

CONFIG SET latency-monitor-threshold 100
LATENCY LATEST
LATENCY HISTORY command
# For the slowest commands: SLOWLOG GET 10

Depois que o limite do latency monitor é definido, LATENCY LATEST/HISTORY informa os eventos que causam mais latência.

Elasticsearch

GET _nodes/hot_threads

_nodes/hot_threads revela gargalos fornecendo stack traces das threads que mais consomem CPU.

Abrir no DBAtlas →