Skip to content

Instantly share code, notes, and snippets.

@zyqxd
Last active September 20, 2024 19:06
Show Gist options
  • Save zyqxd/bbd41f10c8c03af42d584ec09c8749e3 to your computer and use it in GitHub Desktop.
Save zyqxd/bbd41f10c8c03af42d584ec09c8749e3 to your computer and use it in GitHub Desktop.
cloudwatch_insights
parse @message /Query_time:\s*(?<Query_time>[0-9]+(?:\.[0-9]+)?)\s*Lock_time:\s*(?<Lock_time>[0-9]+(?:\.[0-9]+)?)[\s\S]*?;/
| parse @message /SET timestamp=\d+;\n(?<RawQuery>[^;]*)/
| stats count() as QueryCount, avg(Query_time) as AvgQueryTime, avg(Query_time) as AvgLockTime by RawQuery
| sort AvgQueryTime desc
| limit 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment