有没有批量分析mysql慢日志的方法?
有台mysql服务器运行了30多个mysql服务,想每天看看有没有新增的慢sql,墨友有啥好办法吗?
mysqldumpslow好像无法指定时段
我来答
添加附件
收藏
复制链接
微信扫码分享
在小程序上查看
分享
添加附件
问题补充
3条回答
默认
最新
pt-query-digest 值得拥有
--since
type: string
Parse only queries newer than this value (parse queries since this date).
This option allows you to ignore queries older than a certain value and parse only those queries which are more recent than the value. The value can be several
types:
* Simple time value N with optional suffix: N[shmd], where
s=seconds, h=hours, m=minutes, d=days (default s if no suffix
given); this is like saying "since N[shmd] ago"
* Full date with optional hours:minutes:seconds:
YYYY-MM-DD [HH:MM:SS]
* Short, MySQL-style date:
YYMMDD [HH:MM:SS]
* Any time expression evaluated by MySQL:
CURRENT_DATE - INTERVAL 7 DAY
If you give a MySQL time expression, and you have not also specified a DSN for "--explain", "--processlist", or "--review", then you must specify a DSN on the
command line so that pt-query-digest can connect to MySQL to evaluate the expression.
The MySQL time expression is wrapped inside a query like "SELECT UNIX_TIMESTAMP(<expression>)", so be sure that the expression is valid inside this query. For
example, do not use UNIX_TIMESTAMP() because UNIX_TIMESTAMP(UNIX_TIMESTAMP()) returns 0.
Events are assumed to be in chronological: older events at the beginning of the log and newer events at the end of the log. "--since" is strict: it ignores all
queries until one is found that is new enough. Therefore, if the query events are not consistently timestamped, some may be ignored which are actually new
enough.
See also "--until".
评论
有用 2
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏


