当前位置:网站首页>MySQL之零碎知识点
MySQL之零碎知识点
2022-06-30 16:16:00 【wang0907】
写在前面
本部分用来记录MySQL学习过程中比较小的零碎知识点,分享出去的同时也方便自己后续查看。
1:慢日志
慢日志主要参数如下:
控制开关:slow_query_log
写慢日志执行时长:long_query_time
慢日志文件:slow_query_log_file
如下设置:
mysql> set global slow_query_log=1;
Query OK, 0 rows affected (0.04 sec)
mysql> show variables like 'slow_query_log';
+---------------------+---------------------------------------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------------------------------------+
| slow_query_log | ON |
+---------------------+---------------------------------------------------------------+
1 rows in set (0.00 sec)
mysql> set long_query_time=0;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name | Value |
+-----------------+----------+
| long_query_time | 0.000000 |
+-----------------+----------+
1 row in set (0.00 sec)
mysql> show variables like 'slow_query_log_file';
+---------------------+---------------------------------------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------------------------------------+
| slow_query_log_file | D:\program_files\phpstudy\PHPTutorial\MySQL\data\jhp-slow.log |
+---------------------+---------------------------------------------------------------+
1 row in set (0.00 sec)
为了测试效果将long_query_time设置为0,这样所有执行的sql语句都会记录到慢日志中,比如执行如下的sql语句:
mysql> select count(*) from t;
+----------+
| count(*) |
+----------+
| 100000 |
+----------+
就可以查看生成的慢日志了:

写在后面
参考文章列表:
边栏推荐
- Exch:exchange server 2013 is about to end support
- 力士乐液控单向阀Z2S10-1-3X/
- addmodule_allmerge_ams_im
- Plane intersection and plane equation
- "Promotion + funny plot", how to collide with the sparks of popular funds?
- 理解现货白银走势的关键
- Exch:Exchange Server 2013 即将终止支持
- 以往我们认识的产业互联网,只是以消费互联网的替代者的身份出现
- Write the simplest small program in C language Hello World
- Cesium-1.72 learning (China national boundary)
猜你喜欢

解决方法:STM32使用cJSON解析数据失败

期未课程设计:基于SSM的产品销售管理系统

Differential analysis between different groups nichenet for silicosis runs successfully!

Data security compliance has brought new problems to the risk control team
![万卷书 - 书单整理 [01]](/img/d4/124101b919a4d8163a32fc0f158efa.png)
万卷书 - 书单整理 [01]

Splitting. JS text title slow loading JS effect

开发那些事儿:如何在视频中添加文字水印?

Construction schedule of intelligent management and control platform in Shanxi Chemical Industry Park

EMQ 助力青岛研博建设智慧水务平台

.NET ORM框架HiSql实战-第一章-集成HiSql
随机推荐
3D chart effectively improves the level of large data screen
定时任务删除指定时间的的数据
The new version of Shangding cloud | favorites function has been launched to meet personal use needs
Bridge emqx cloud data to AWS IOT through the public network
In the past, the industrial Internet we knew only appeared as a substitute for the consumer Internet
Required plug-ins for idea
New power of data analysis -- the first open source integrated real-time HTAP database in China was released by stonedb
Property or method “approval1“ is not defined on the instance but referenced during render
Ningx 1.20.2
EMQ helps Qingdao Yanbo build a smart water platform
开发那些事儿:如何在视频中添加文字水印?
.NET ORM框架HiSql实战-第一章-集成HiSql
leetcode:1042. 不邻接植花【随机填入符合要求的 + 后面不会形成矛盾 + set.pop】
EMQ 助力青岛研博建设智慧水务平台
Pref usage record
addmodule_ allmerge_ ams_ im
Redis elimination strategy
Hyper-v:在虚拟网络中启用 SR-IOV
Cloud practice of key business migration of Internet of things by well-known Internet housing rental service companies
新技能:通过代码缓存加速 Node.js 的启动