1.mysql-log-filter工具脚本使用说明:
google code上找到的一个分析工具.提供了 python 和 php 两种可执行的脚本。http://code.google.com/p/mysql-log-filter/ (需要搬梯子爬墙),51cto下载链接:http://down.bitsCN.com/data/2123725
使用方法:(这里只介绍python的使用方法)
python mysql_filter_slow_log.py ./mysql1-slow.log --no-duplicates --sort-execution-count --top=10 >> mysql_slow_test.txt
备注:mysql1-slow.log 慢查询日志名称
--no-duplicates
--sort-execution-count
--top=10 取前十位
mysql_slow_test.txt 输出分析报告
附录:
官方给出的使用方法举例:
=====================================
# Filter slow queries executed for at least 3 seconds not from root, remove duplicates, # apply execution count as first sorting value and save first 10 unique queries to file. # In addition, remember last input file position and statistics. php mysql_filter_slow_log.php -T=3 -eu=root --no-duplicates --sort-execution-count --top=10 --incremental linux-slow.log > mysql-slow-queries.log # Start permanent filtering of all slow queries from now on: at least 3 seconds or examining 10000 rows, exclude users root and test tail -f -n 0 linux-slow.log | python mysql_filter_slow_log.py -T=3 -R=10000 -eu=root -eu=test & # (-n 0 outputs only lines generated after start of tail) # Stop permanent filtering kill `ps auxww | grep 'tail -f -n 0 linux-slow.log' | egrep -v grep | awk '{print $2}'`
====================================
官方给出的命令参数:
==================================
-T=min_query_time -R=min_rows_examined -ih, --include-host -eh, --exclude-host -iu, --include-user -eu, --exclude-user -iq, --include-query --date=date_first-date_last Include only queries between date_first (and date_last). Input: Date Range: 13.11.2006 -> 13.11.2006 - 14.11.2006 (exclusive) 13.11.2006-15.11.2006 -> 13.11.2006 - 16.11.2006 (exclusive) 15-11-2006-11/13/2006 -> 13.11.2006 - 16.11.2006 (exclusive) >13.11.2006 -> 14.11.2006 - later 13.11.2006- -> 13.11.2006 - later <13.11.2006 -> earlier - 13.11.2006 (exclusive) -13.11.2006 -> earlier - 14.11.2006 (exclusive) Please do not forget to escape the greater or lesser than symbols (><, i.e. '--date=>13.11.2006'). Short dates are supported if you include a trailing separator (i.e. 13.11.-11/15/). --incremental Remember input file positions and optionally --no-duplicates statistics between executions in mysql_filter_slow_log.sqlite3 --no-duplicates Powerful option to output only unique query strings with additional statistics: Execution count, first and last timestamp. Query time: avg / max / sum. Lock time: avg / max / sum. Rows examined: avg / max / sum. Rows sent: avg / max / sum. --no-output Do not print statistics, just update database with incremental statistics Default ordering of unique queries: --sort-sum-query-time [ 1. position] --sort-avg-query-time [ 2. position] --sort-max-query-time [ 3. position] --sort-sum-lock-time [ 4. position] --sort-avg-lock-time [ 5. position] --sort-max-lock-time [ 6. position] --sort-sum-rows-examined [ 7. position] --sort-avg-rows-examined [ 8. position] --sort-max-rows-examined [ 9. position] --sort-execution-count [10. position] --sort-sum-rows-sent [11. position] --sort-avg-rows-sent [12. position] --sort-max-rows-sent [13. position] --sort=sum-query-time,avg-query-time,max-query-time,... You can include multiple sorting values separated by commas. --sort=sqt,aqt,mqt,slt,alt,mlt,sre,are,mre,ec,srs,ars,mrs Every long sorting option has an equivalent short form (first character of each word). --top=max_unique_query_count Output maximal max_unique_query_count different unique queries --details Enables output of timestamp based unique query time lines after user list (i.e. # Query_time: 81 Lock_time: 0 Rows_sent: 884 Rows_examined: 2448350). --help Output this message only and quit [multiple] options can be passed more than once to set multiple values. [position] options take the position of their first occurrence into account. The first passed option will replace the default first sorting, ... Remaining default ordering options will keep their relative positions.
====================================
官方给出的配置文件中管理慢日志参数的配置
====================================
# I.e. you could add the following lines under the [mysqld] section of your my.ini or my.cnf configuration file: # Log all queries taking more than 3 seconds long_query_time=3 # minimum: 1, default: 10 # MySQL >= 5.1.21 (or patched): 3 seconds = 3000000 microseconds # long_query_time=3.000000 # minimum: 0.000001 (1 microsecond) # Activate the Slow Query Log slow_query_log # >= 5.1.29 # log-slow-queries # deprecated since 5.1.29 # Write to a custom file name (>= 5.1.29) # slow_query_log_file=file_name # default: /data_dir/host_name-slow.log # Log all queries without indexes # log-queries-not-using-indexes # Log only queries which examine at least N rows (>= 5.1.21) # min_examined_row_limit=1000 # default: 0 # Log slow OPTIMIZE TABLE, ANALYZE TABLE, and ALTER TABLE statements # log-slow-admin-statements # Log slow queries executed by replication slaves (>= 5.1.21) # log-slow-slave-statements # MySQL 5.1.6 through 5.1.20 had a default value of log-output=TABLE, so you should force # Attention: logging to TABLE only includes whole seconds information log-output=FILE ## Admin query for online activation is possible since MySQL 5.1 (without server restart) ## SET @@global.slow_query_log=1 ## SET @@global.long_query_time=1 ## Show current variables related to the Slow Query Log ## SHOW GLOBAL VARIABLES WHERE Variable_name REGEXP 'admin|min_examined|log_output|log_queries|log_slave|long|slow_quer'
======================================
注意:在执行脚本的时候会报数据类型的错误,具体错误指定469行,经过查看,实际慢查询日志中的query_time是float类型,而在这个脚本工具中定义的确实int类型。于是自行修改!
默认:
======================
query_time = (int(numbers[1].split()[0]), int(numbers[2].split()[0]),
int(numbers[3].split()[0]), int(numbers[4]))
======================
修改为:
======================
query_time = (float(numbers[1].split()[0]), float(numbers[2].split()[0]),
float(numbers[3].split()[0]), float(numbers[4]))

随着互联网技术和人工智能的发展,越来越多的内容创作者开始采用各种AI工具来提高创作效率和质量。本文将介绍8个最流行的AI工具,它们可以帮助你轻松实现10倍的效率提升,让你更快地完成内容创作任务,同时保证内容的高质量和创意。Chatsonic一个类似chatgpt的聊天机器人,具有实时数据、图像、语音搜索等功能。专门为内容创作者设计的AI聊天机器人来提升你的生产力。网址:https://writesonic.com/chatMidjourney一个由人工智能驱动的系统,根据用户输入的提示创建图像。

ChatGPT 之前几十年来,人工智能 (AI) 一直在改变我们的生活和工作方式。从使用 AI 驱动的虚拟助手改善我们的个人生活,到通过智能自动化彻底改变整个行业,AI 一次又一次地证明了它的价值。但在 ChatGPT 之前,AI 过去常常执行特定的小任务,很少有人认真对待它。ChatGPT 之后有了 ChatGPT,世界变得疯狂了。就那么几天之内,人们都在谈论这种令人兴奋的语言模型的强大功能。重点突然转移到基于人工智能的工具上,越来越多的人开始使用这些基于人工智能的工具,从那时起,更多工具应运

糟透了我承认我不是一个爱整理桌面的人,因为我觉得乱糟糟的桌面,反而容易找到文件。哈哈,可是最近桌面实在是太乱了,自己都看不下去了,几乎占满了整个屏幕。虽然一键整理桌面的软件很多,但是对于其他路径下的文件,我同样需要整理,于是我想到使用Python,完成这个需求。效果展示我一共为将文件分为9个大类,分别是图片、视频、音频、文档、压缩文件、常用格式、程序脚本、可执行程序和字体文件。# 不同文件组成的嵌套字典 file_dict = { '图片': ['jpg','png','gif','webp

自 2020 年以来,内容开发领域已经感受到人工智能工具的存在。1.Jasper AI网址:https://www.jasper.ai在可用的 AI 文案写作工具中,Jasper 作为那些寻求通过内容生成赚钱的人来讲,它是经济实惠且高效的选择之一。该工具精通短格式和长格式内容均能完成。Jasper 拥有一系列功能,包括无需切换到模板即可快速生成内容的命令、用于创建文章的高效长格式编辑器,以及包含有助于创建各种类型内容的向导的内容工作流,例如,博客文章、销售文案和重写。Jasper Chat 是该

大家好,我是Python人工智能技术喜欢用 Python 做项目的小伙伴不免会遇到这种情况:做图表时,用哪种好看又实用的可视化工具包呢?之前文章里出现过漂亮的图表时,也总有读者在后台留言问该图表时用什么工具做的。下面,作者介绍了八种在 Python 中实现的可视化工具包,其中有些包还能用在其它语言中。快来试试你喜欢哪个?用 Python 创建图形的方法有很多,但是哪种方法是最好的呢?当我们做可视化之前,要先明确一些关于图像目标的问题:你是想初步了解数据的分布情况?想展示时给人们留下深刻印象?也许

Instagram正在测试用户验证年龄的新方法,包括由第三方公司Yoti开发的一款人工智能工具,它可以通过扫描你的脸来估计你的年龄。按照官方规定,必须年满13岁才能注册Instagram账户。但多年来,该公司几乎没有努力执行这一规定。它甚至都懒得问新用户的生日,更不用说核实这些信息了。然而,直到2019年遭到隐私和儿童安全专家的猛烈抨击之后,Instagram推出了越来越多的年龄验证功能,以及将年轻用户与成年用户区分开来的方法。目前,在青少年试图修改自己的出生日期,显示自己年满18岁时Inst

壁纸 API我们这里使用一个开源在 GitHub 上的必应壁纸 API 作为壁纸的来源https://github.com/zenghongtu/bing-wallpaper从 readme 当中我们可以知道,在 web 应用中我只需要使用如下引用即可<img src="https://bingw.jasonzeng.dev/?w=800"/>实在是太方便了接口使用下面我们来看下该 API 的具体调用规则1、传入 resolution 参数可以指

我们非常接近 2023 年,我们都希望在新的一年里基于 AI 的工具会出现爆炸式增长,这是有充分理由的。如果像我一样,你是这些技术的忠实粉丝,以及它们如何将我们的生产力提高 10 倍,你可以在这篇文章中找到该领域的 7 种工具列表。您知道吗,您可以在DoTenX上免费实施带有或不带有编码的网络应用程序、API、网站或登录页面?请务必检查一下,甚至提名您的作品进行展示。DoTenX 是开源的,您可以在此处找到存储库:github.com/dotenx/dotenx。现在,让我们来看看我们的列表。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version
SublimeText3 Linux latest version