Skip to content

Commit

Permalink
Update who-ate-my-cpu.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-zaitsev committed Oct 18, 2023
1 parent ef62c9c commit ee98ca6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions content/en/altinity-kb-setup-and-maintenance/who-ate-my-cpu.md
Expand Up @@ -50,15 +50,17 @@ select elapsed, query from system.processes where is_initial_query and elapsed >
SELECT
normalizedQueryHash(query),
current_database,
sum(`ProfileEvents.Values`[indexOf(`ProfileEvents.Names`, 'UserTimeMicroseconds')]) AS userCPU,
sum(`ProfileEvents.Values`[indexOf(`ProfileEvents.Names`, 'UserTimeMicroseconds')])/1000 AS userCPUms,
count(),
avg(query_duration_ms) query_duration_ms,
any( substr(query, 1, 60) ) _query
sum(query_duration_ms) query_duration_ms,
userCPUms/query_duration_ms cpu_per_sec,
any(query)
FROM system.query_log
WHERE (type = 2) AND (event_date >= today())
GROUP BY
current_database,
normalizedQueryHash(query)
ORDER BY userCPU DESC
LIMIT 10;
ORDER BY userCPUms DESC
LIMIT 10
FORMAT Vertical;
```

0 comments on commit ee98ca6

Please sign in to comment.