当前位置:网站首页>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 |
+----------+
就可以查看生成的慢日志了:

写在后面
参考文章列表:
边栏推荐
- 阿里云盘分享压缩包
- Redis data structure analysis
- 【C语言】详解线程 — 多线程进行协同运算
- [untitled] write a student achievement and information management system in C language to realize the operation interface, clear screen display of current operation functions, reading and inputting st
- Hyper-V: enable SR-IOV in virtual network
- Network: principle and practice of server network card group technology
- splitting. JS password display hidden JS effect
- Exch:完整性检查 Database Integrity Checking
- svg实现的订票UI效果
- Hyper-v:在虚拟网络中启用 SR-IOV
猜你喜欢

Acwing game 57

Servlet运行原理_API详解_请求响应构造进阶之路(Servlet_2)

China Infrastructure Development Association: electronic contract is recommended

6 張圖帶你搞懂 TCP 為什麼是三次握手?

Cloud practice of key business migration of Internet of things by well-known Internet housing rental service companies

Cesium-1.72 learning (China national boundary)

How can you choose to work in the county after graduation?

【JVM】类加载相关面试题——类加载过程、双亲委派模型

Write the simplest small program in C language Hello World

Course design for the end of the semester: product sales management system based on SSM
随机推荐
Implementation of graduation project management system based on SSM
Consolidate entry-C basic variables and constants
阿里云盘分享压缩包
geo 读取单细胞csv表达矩阵 单细胞 改列名 seurat
5G业务正式商用,属于广电的机会在哪?
pref使用记录
浅析搭建高速公路视频监控平台的建设方案及必要性
Sub chain cross technology source level exploration: an overview of xcvm
Internet R & D efficiency practice qunar core field Devops landing practice
【Proteus仿真】Arduino UNO利用74LS148扩展中断
leetcode:787. K 站中转内最便宜的航班【k步最短路 + dfs记忆化 + defaultdict(dict)】
A tough battle for Tencent cloud
登录框Tricks
每日刷题记录 (九)
List becomes vector list becomes vector list vector
Exch:修复丢失的系统邮箱
leetcode:1042. 不邻接植花【随机填入符合要求的 + 后面不会形成矛盾 + set.pop】
Mysql8 NDB cluster installation and deployment
以往我们认识的产业互联网,只是以消费互联网的替代者的身份出现
Property or method “approval1“ is not defined on the instance but referenced during render