MySQL慢SQL优化思路

MySQL慢SQL优化思路

具体思路:

1、慢查询日志记录慢 SQL

2、explain 分析 SQL 的执行计划

3、profile 分析执行耗时

4、Optimizer Trace 分析详情

5、确定问题并采用相应的措施

1、查看慢日志

1.1 使用命令查询慢日志配置

mysql> show variables like 'slow_query_log%';
+---------------------+---------------------------------------------------------------------+
| Variable_name       | Value                                                               |
+---------------------+---------------------------------------------------------------------+
| slow_query_log      | OFF                                                                 |
| slow_query_log_file | C:\ProgramData\MySQL\MySQL Server 5.5\Data\DESKTOP-CR3IL33-slow.log |
+---------------------+---------------------------------------------------------------------+
2 rows in set (0.00 sec)
  • slow_query_log:表示慢查询开启的状态。
  • slow_query_log_file:表示慢查询日志存放的位置。

1.2 使用命令查看超过多少时间才记录到慢查询日志

mysql> show variables like 'long_query_time';
+-----------------+-----------+
| Variable_name   | Value     |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.00 sec)
  • long_query_time:表示查询超过多少秒才记录到慢查询日志。

1.3 查看是否开启记录未使用索引sql慢查询日志

-- 默认是关闭的
mysql> show variables like 'log_queries_not_using_indexes';
+-------------------------------+-------+
| Variable_name                 | Value |
+-------------------------------+-------+
| log_queries_not_using_indexes | OFF   |
+-------------------------------+-------+
1 row in set (0.00 sec)

1.4 启用慢日志

-- 启用慢查询,加上global,不然会报错的
mysql> set global slow_query_log='ON';
Query OK, 0 rows affected (0.01 sec)
-- 是否开启慢查询
mysql> show variables like 'slow_query_log%';
+---------------------+---------------------------------------------------------------------+
| Variable_name       | Value                                                               |
+---------------------+---------------------------------------------------------------------+
| slow_query_log      | ON                                                                  |
| slow_query_log_file | C:\ProgramData\MySQL\MySQL Server 5.5\Data\DESKTOP-CR3IL33-slow.log |
+---------------------+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

1.5 修改慢查询时间

-- 修改慢查询时间
mysql> set global long_query_time=2;
Query OK, 0 rows affected (0.00 sec)
-- 查看慢查询时间阈值
mysql> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 2.000000 |
+-----------------+----------+
1 row in set (0.00 sec)-- 修改了慢查询日志马上用上述命令查看发现不生效,其实已经修改成功,可以用下面的命令
mysql> show global variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 2.000000 |
+-----------------+----------+
1 row in set (0.00 sec)

1.6 开启记录未使用索引sql慢查询日志

-- 开启
mysql> set global log_queries_not_using_indexes=1;
Query OK, 0 rows affected (0.00 sec)
-- 查询
mysql> show variables like 'log_queries_not_using_indexes';
+-------------------------------+-------+
| Variable_name                 | Value |
+-------------------------------+-------+
| log_queries_not_using_indexes | ON    |
+-------------------------------+-------+
1 row in set (0.00 sec)

1.7 永久生效

上面的操作并不是永久开启慢查询日志,如果要永久生效,就必须修改配置文件 my.cnfmy.ini,在该文件

中,找到或在 [mysqld] 部分下添加以下内容,然后保存文件并重启 MySQL 服务。

# 开启慢查询日志
slow_query_log=1# 指定慢查询日志生成文件所在路径
slow_query_log_file=D:\OwnerSoftwareInstall\MySQL\zsx-slow.log# 设置慢查询时间阈值
long_query_time=2# 开启记录未使用索引sql慢查询日志
log_queries_not_using_indexes=1# 日志输出方式为文件
log_output=FILE
-- 查看
mysql> show variables like 'slow_query_log%';
+---------------------+--------------------------------------------+
| Variable_name       | Value                                      |
+---------------------+--------------------------------------------+
| slow_query_log      | ON                                         |
| slow_query_log_file | D:\OwnerSoftwareInstall\MySQL\zsx-slow.log |
+---------------------+--------------------------------------------+
2 rows in set (0.00 sec)

1.8 定位慢查询

看看mysql从启动到现在,mysql数据库的一些运行状态:

mysql> flush status;
Query OK, 0 rows affected (0.00 sec)
-- 从启动到现在执行select次数
mysql> show global status like 'com_select';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select    | 3     |
+---------------+-------+
1 row in set (0.00 sec)
-- 当前session里执行select次数,session可以不加
mysql> show session status like 'com_select';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select    | 1     |
+---------------+-------+
1 row in set (0.00 sec)
-- 从启动到现在执行update次数
mysql> show global status like 'com_update';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_update    | 0     |
+---------------+-------+
1 row in set (0.00 sec)
-- 当前session里执行update次数,session可以不加
mysql> show session status like 'com_update';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_update    | 0     |
+---------------+-------+
1 row in set (0.00 sec)
-- 从启动到现在执行delete次数
mysql> show global status like 'com_delete';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_delete    | 0     |
+---------------+-------+
1 row in set (0.00 sec)
-- 当前session里执行delete次数,session可以不加
mysql> show session status like 'com_delete';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_delete    | 0     |
+---------------+-------+
1 row in set (0.00 sec)
-- 从开启慢查询日志开始到现在有多少条慢查询记录
mysql> show global status like '%slow_queries%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries  | 1     |
+---------------+-------+
1 row in set (0.00 sec)

1.9 使用mysqldumpslow工具分析慢查询

日志分析工具mysqldumpslow,mysql官方自带的,只要安装了mysql就可以使用它,可以用来帮助我们分析慢

日志文件。

# 指定慢查询日志进行分析
# 查询执行时间最长的前10
$ perl mysqldumpslow.pl -s t -a -t 10 D:\OwnerSoftwareInstall\MySQL\zsx-slow.log

在这里插入图片描述

$ perl mysqldumpslow.pl --help
Locale 'Chinese (Simplified)_China.936' is unsupported, and may crash the interpreter.
Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]Parse and summarize the MySQL slow query log. Options are--verbose    verbose--debug      debug--help       write this text to standard output-v           verbose-d           debug-s ORDER     what to sort by (al, at, ar, c, l, r, t), 'at' is defaultal: average lock timear: average rows sentat: average query timec: countl: lock timer: rows sentt: query time-r           reverse the sort order (largest last instead of first)-t NUM       just show the top n queries-a           don't abstract all numbers to N and strings to 'S'-n NUM       abstract numbers with at least n digits within names-g PATTERN   grep: only consider stmts that include this string-h HOSTNAME  hostname of db server for *-slow.log filename (can be wildcard),default is '*', i.e. match all-i NAME      name of server instance (if using mysql.server startup script)-l           don't subtract lock time from total time
参数选项使用说明
-a显示具体的数字和字符信息,而不是用N或者S代替
-n将数字抽象显示为指定的数字个数
–debug | -d指定debug模式运行
-g指定大小写不敏感的正则表达
–help显示帮助信息
-h指定MySQL主机名称用于选择慢查询日志
-i指定服务器示例名称用于选择慢查询日志
-l显示总时间(包括lock锁定时间)
-r逆序排序
-s指定排序方式
-t只显示指定数量的结果内容
–verbose | -vVerbose模式

使用-s指定排序方式,主要有如下四种方式:

  • l: 按锁定时间排序
  • r: 按结果行数排序
  • t: 按查询时间排序
  • c:按执行次数排序

a为平均,与上述参数结合可形成新的排序方式:

  • at:按平均查询时间排序(默认排序方式)
  • al:按平均锁定时间排序
  • ar:按平均结果行数排序
# 返回执行次数最高的前10条sql
$ perl mysqldumpslow.pl -s c -a -t 10 D:\OwnerSoftwareInstall\MySQL\zsx-slow.log# 返回结果行数最多的前10条sql
$ perl mysqldumpslow.pl -s r -a -t 10 D:\OwnerSoftwareInstall\MySQL\zsx-slow.log# 返回执行时间最长的前10条sql
$ perl mysqldumpslow.pl -s t -a -t 10 D:\OwnerSoftwareInstall\MySQL\zsx-slow.log

分析后结果参数解读

  • Count:代表这个 SQL 语句执行了多少次
  • Time:代表执行的时间,括号是累计时间
  • Lock:表示锁定的时间,括号是累计时间
  • Rows:表示返回的记录数,括号是累计记录数

2、explain 分析 SQL 的执行计划

mysql> explain select * from student;
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| id | select_type | table   | type | possible_keys | key  | key_len | ref  | rows | Extra |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
|  1 | SIMPLE      | student | ALL  | NULL          | NULL | NULL    | NULL |    7 |       |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)

type=all 代表进行了全表扫描。

3、show profile分析

了解SQL执行的线程的状态及消耗的时间。

profiling 默认是关闭,我们可以使用命令查看是否开启:

-- 未开启
mysql> show variables like '%profil%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| have_profiling         | YES   |
| profiling              | OFF   |
| profiling_history_size | 15    |
+------------------------+-------+
3 rows in set (0.00 sec)-- 开启
mysql> show variables like '%profil%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| have_profiling         | YES   |
| profiling              | ON    |
| profiling_history_size | 15    |
+------------------------+-------+
3 rows in set (0.00 sec)
-- 默认是关闭的,开启语句set profiling = 1;也可以使用set profiling=ON;开启
mysql> set profiling =1;
Query OK, 0 rows affected (0.00 sec)-- 执行SQL
mysql> select * from student;
+----+-------+
| id | name  |
+----+-------+
|  1 | John  |
|  2 | tom   |
|  3 | marry |
|  6 | marry |
|  7 | tom   |
| 10 | marry |
| 11 | tom   |
+----+-------+
7 rows in set (0.00 sec)-- 可以看到实际的执行语句
mysql> show profiles;
+----------+------------+-----------------------+
| Query_ID | Duration   | Query                 |
+----------+------------+-----------------------+
|        1 | 0.00017550 | select * from student |
+----------+------------+-----------------------+
1 row in set (0.00 sec)

show profiles 会显示最近发给服务器的多条语句,条数由变量 profiling_history_size 定义,默认是15。

如果我们需要看单独某条SQL的分析,可以show profile查看最近一条SQL的分析,也可以使用show profile

for query id(其中id就是show profiles中的QUERY_ID)查看具体一条的SQL语句分析。

mysql> show profiles;
+----------+------------+-----------------------+
| Query_ID | Duration   | Query                 |
+----------+------------+-----------------------+
|        1 | 0.00017550 | select * from student |
+----------+------------+-----------------------+
1 row in set (0.00 sec)
mysql> show profile for query 1;
+----------------------+----------+
| Status               | Duration |
+----------------------+----------+
| starting             | 0.000024 |
| checking permissions | 0.000003 |
| Opening tables       | 0.000015 |
| System lock          | 0.000004 |
| init                 | 0.000008 |
| optimizing           | 0.000002 |
| statistics           | 0.000005 |
| preparing            | 0.000004 |
| executing            | 0.000001 |
| Sending data         | 0.000033 |
| end                  | 0.000002 |
| query end            | 0.000002 |
| closing tables       | 0.000003 |
| freeing items        | 0.000025 |
| logging slow query   | 0.000001 |
| logging slow query   | 0.000044 |
| cleaning up          | 0.000002 |
+----------------------+----------+
17 rows in set (0.00 sec)

除了查看 profile ,还可以查看 cpu 和 io:

mysql> show profile cpu,block io for query 1;
+----------------------+----------+----------+------------+--------------+---------------+
| Status               | Duration | CPU_user | CPU_system | Block_ops_in | Block_ops_out |
+----------------------+----------+----------+------------+--------------+---------------+
| starting             | 0.000024 | 0.000000 |   0.000000 |         NULL |          NULL |
| checking permissions | 0.000003 | 0.000000 |   0.000000 |         NULL |          NULL |
| Opening tables       | 0.000015 | 0.000000 |   0.000000 |         NULL |          NULL |
| System lock          | 0.000004 | 0.000000 |   0.000000 |         NULL |          NULL |
| init                 | 0.000008 | 0.000000 |   0.000000 |         NULL |          NULL |
| optimizing           | 0.000002 | 0.000000 |   0.000000 |         NULL |          NULL |
| statistics           | 0.000005 | 0.000000 |   0.000000 |         NULL |          NULL |
| preparing            | 0.000004 | 0.000000 |   0.000000 |         NULL |          NULL |
| executing            | 0.000001 | 0.000000 |   0.000000 |         NULL |          NULL |
| Sending data         | 0.000033 | 0.000000 |   0.000000 |         NULL |          NULL |
| end                  | 0.000002 | 0.000000 |   0.000000 |         NULL |          NULL |
| query end            | 0.000002 | 0.000000 |   0.000000 |         NULL |          NULL |
| closing tables       | 0.000003 | 0.000000 |   0.000000 |         NULL |          NULL |
| freeing items        | 0.000025 | 0.000000 |   0.000000 |         NULL |          NULL |
| logging slow query   | 0.000001 | 0.000000 |   0.000000 |         NULL |          NULL |
| logging slow query   | 0.000044 | 0.000000 |   0.000000 |         NULL |          NULL |
| cleaning up          | 0.000002 | 0.000000 |   0.000000 |         NULL |          NULL |
+----------------------+----------+----------+------------+--------------+---------------+
17 rows in set (0.00 sec)

4、Optimizer Trace分析详情(mysql 5.6 及以上版本)

profile 只能查看到 SQL 的执行耗时,但是无法看到 SQL 真正执行的过程信息,即不知道 MySQL 优化器是如何选

择执行计划。这时候,我们可以使用Optimizer Trace,它可以跟踪执行语句的解析优化执行的全过程。

-- 第一步打开trace,设置格式为JSON格式
mysql> set session optimizer_trace="enabled=on",end_markers_in_json=ON;
Query OK, 0 rows affected (0.00 sec)-- 设置优化器跟踪使用的最大内存量
mysql> set session optimizer_trace_max_mem_size=1000000;
Query OK, 0 rows affected (0.00 sec)-- 查看
mysql> show session variables like 'optimizer_trace';
+-----------------+-------------------------+
| Variable_name   | Value                   |
+-----------------+-------------------------+
| optimizer_trace | enabled=on,one_line=off |
+-----------------+-------------------------+
1 row in set (0.00 sec)
-- 第二步,执行要分析的sql语句
mysql> select * from student;
+----+-------+
| id | name  |
+----+-------+
|  1 | John  |
|  2 | tom   |
|  3 | marry |
|  6 | marry |
|  7 | tom   |
| 10 | marry |
| 11 | tom   |
+----+-------+
7 rows in set (0.00 sec)
-- 第三步,查看information_schema.OPTIMIZER_TRACE,查看sql语句执行跟踪记录
mysql> select * from information_schema.optimizer_trace;
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+-------------------------+
| QUERY                 | TRACE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | MISSING_BYTES_BEYOND_MAX_MEM_SIZE | INSUFFICIENT_PRIVILEGES |
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+-------------------------+
| select * from student | {"steps": [{"join_preparation": {"select#": 1,"steps": [{"expanded_query": "/* select#1 */ select `student`.`id` AS `id`,`student`.`name` AS `name` from `student`"}] /* steps */} /* join_preparation */},{"join_optimization": {"select#": 1,"steps": [{"table_dependencies": [{"table": "`student`","row_may_be_null": false,"map_bit": 0,"depends_on_map_bits": [] /* depends_on_map_bits */}] /* table_dependencies */},{"rows_estimation": [{"table": "`student`","table_scan": {"rows": 7,"cost": 0.25} /* table_scan */}] /* rows_estimation */},{"considered_execution_plans": [{"plan_prefix": [] /* plan_prefix */,"table": "`student`","best_access_path": {"considered_access_paths": [{"rows_to_scan": 7,"access_type": "scan","resulting_rows": 7,"cost": 0.95,"chosen": true}] /* considered_access_paths */} /* best_access_path */,"condition_filtering_pct": 100,"rows_for_plan": 7,"cost_for_plan": 0.95,"chosen": true}] /* considered_execution_plans */},{"attaching_conditions_to_tables": {"original_condition": null,"attached_conditions_computation": [] /* attached_conditions_computation */,"attached_conditions_summary": [{"table": "`student`","attached": null}] /* attached_conditions_summary */} /* attaching_conditions_to_tables */},{"finalizing_table_conditions": [] /* finalizing_table_conditions */},{"refine_plan": [{"table": "`student`"}] /* refine_plan */}] /* steps */} /* join_optimization */},{"join_execution": {"select#": 1,"steps": [] /* steps */} /* join_execution */}] /* steps */
} |                                 0 |                       0 |
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+-------------------------+
1 row in set (0.00 sec)
-- 第四步,关闭trace。
mysql> set session optimizer_trace="enabled=off";
Query OK, 0 rows affected (0.00 sec)-- 查看
mysql> show session variables like 'optimizer_trace';
+-----------------+--------------------------+
| Variable_name   | Value                    |
+-----------------+--------------------------+
| optimizer_trace | enabled=off,one_line=off |
+-----------------+--------------------------+
1 row in set (0.00 sec)

可以查看分析其执行树,会包括三个阶段:

  • join_preparation:准备阶段
  • join_optimization:分析阶段
  • join_execution:执行阶段

5、确定问题并采用相应的措施

根据上面4个步骤的分析结果进行相应的优化。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/215331.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mysql 5.7.34升级到5.7.44修补漏洞

mysql 5.7.34旧版本,漏扫有漏洞,升级到最新版本 旧版本5.7.34在 /home/mysql/mysql中安装 备份旧版本数据还有目录 数据库备份升级 tar -xf mysql-5.7.44-el7-x86_64.tar #覆盖旧版本数据库文件 #注意看看文件是否和你起服务的用户一样 \cp -r mysql-5…

decomposition-based multi-objective algorithm4SPDPTW

关键词 文章概述 研究背景 多目标选择性接送和配送问题(PDPs):研究涉及多目标选择性接送和配送问题,这些问题传统上从单一目标角度进行探讨,以寻找最具盈利性的请求集合,同时遵守一系列限制条件。 经济和…

基于OpenCV+CNN+IOT+微信小程序智能果实采摘指导系统——深度学习算法应用(含python、JS工程源码)+数据集+模型(五)

目录 前言总体设计系统整体结构图系统流程图 运行环境Python环境TensorFlow 环境Jupyter Notebook环境Pycharm 环境微信开发者工具OneNET云平台 模块实现1. 数据预处理2. 创建模型并编译3. 模型训练及保存4. 上传结果5. 小程序开发1)查询图片2)查询识别结…

【收获】成长之路

目录 一、前言二、计算机方面三、专业知识方面四、总结 一、前言 四年,对于一个人的成长来说,是一个相当重要的阶段。在这段时间里,我经历了许多挑战、收获了许多成就,也在不断地成长和改变。回首这四年的点点滴滴,我深…

安装LLaMA-Factory微调chatglm3,修改自我认知

安装git clone https://github.com/hiyouga/LLaMA-Factory.git conda create -n llama_factory python3.10 conda activate llama_factory cd LLaMA-Factory pip install -r requirements.txt 之后运行 CUDA_VISIBLE_DEVICES0 python src/train_web.py,按如下配置…

市场全局复盘 20231211

昨日回顾: SELECT TOP 10000 CODE,成交额排名,净流入排名,代码,名称,DDE大单金额,涨幅,所属行业,主力净额,DDE大单净量,CONVERT(DATETIME, 最后涨停时间, 120) AS 最后涨停时间 FROM dbo.全部A股20231208_ALL WHERE 连板天 > 1AND DDE大单净量 > …

什么是零拷贝

什么是零拷贝? 快速理解 快速理解 要想理解零拷贝,首先要了解操作系统的IO流程,因为有内核态和用户态的区别,为了保证安全性和缓存,普通的读写流程如下: (对于Java程序而言,还会多了一个堆外内…

java的long类型超过9位报错:the literal 987654321000 of type int is out of range

java的long类型超过9位报错 1、报错提示2、报错截图3、解决办法4、参考文章 1、报错提示 the literal 987654321000 of type int is out of range 2、报错截图 3、解决办法 long类型是一种用于表示较大整数的数据类型,范围比int类型更广泛。然而,即使…

用PHP和HTML做登录注册操作数据库Mysql

用PHP和HTML做登录注册操作数据库Mysql 两个HTML页面&#xff0c;两个PHP,两个css,两张图片&#xff0c;源码资源在上方。 目录 HTML页面 login.html <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta nam…

IDEA卡顿,进行性能优化设置(亲测有效)——情况二

问题背景与现象 IDEA今天突然显示到期&#xff0c;于是从同事那边搞到一个很好用的破解方式&#xff0c;说实话&#xff0c;非常方便&#xff08;后续在安前码后中分享&#xff09; 破解之后呢&#xff0c;香了一阵子&#xff0c;但是突然显示开始卡顿&#xff0c;界面几乎是…

Word插件-好用的插件-PPT 素材该怎么积累-大珩助手

PPT 素材该怎么积累&#xff1f; 使用大珩助手中的素材库功能&#xff0c;将Word中的&#xff0c;或系统中的文本文件、图片、其他word文档、pdf&#xff0c;所有见到的好素材&#xff0c;一键收纳。 步骤&#xff1a;选中文件&#xff0c;按住鼠标左键拖到素材库界面中&…

【软考】信息系统项目管理师论文方向猜想

报喜不报忧&#xff0c;每天都在为鸡零狗碎推诿扯皮&#xff0c;属实是有辱师门。 通过软考&#xff0c;目前算是真正有意义的事情。 虽然都说高项的论文是个玄学&#xff0c;但是道听途说了一些通关感想还是蛮有启发的。 文件要求 参考了一份广西省高级工程师评审的文件&am…

Leetcode704二分查找、折半查找(Java实现)

好久没有更新算法题&#xff0c;今天来写一道二分查找的题目。题目要求如下&#xff0c; 那么这道题的解题思路如下&#xff0c;我们寻找的过程是首先去访问数组的中间位置mid&#xff0c;如果nums[mid]大于了targe那么说明&#xff0c;我们要找的数在mid的左半边&#xff0c;…

Linux实用操作篇-下篇

Linux实用操作篇-上篇&#xff1a;Linux实用操作-上篇-CSDN博客 一、网络传输 1.1 ping命令 网络是否可联通 可以通过ping命令&#xff0c;检查指定的网络服务器是否是可联通状态 语法: ping [-c num] ip或主机名 选项&#xff1a;-c&#xff0c;检查的次数&#xff0c;…

Dockerfile创建镜像介绍

1.介绍 Docker 提供了一种更便捷的方式&#xff0c;叫作 Dockerfile&#xff0c;docker build命令用于根据给定的Dockerfile构建Docker镜像。 docker build语法&#xff1a; # docker build [OPTIONS] <PATH | URL | -> 常用选项说明 --build-arg&#xff0c;设置构建时的…

上海亚商投顾:沪指探底回升 AI应用方向再度爆发

上海亚商投顾前言&#xff1a;无惧大盘涨跌&#xff0c;解密龙虎榜资金&#xff0c;跟踪一线游资和机构资金动向&#xff0c;识别短期热点和强势个股。 一.市场情绪 三大指数昨日探底回升&#xff0c;早盘一度均跌超1%&#xff0c;午后集体拉升翻红&#xff0c;深成指、创业板…

FFmpeg的AVcodecParser

文章目录 结构体操作函数支持的AVCodecParser 这个模块是AVCodec中的子模块&#xff0c;专门用来提前解析码流的元数据&#xff0c;为后面的解码做准备&#xff0c;这一点对cuda-NVdec非常明显&#xff0c;英伟达解码器的元数据解析是放在CPU上的&#xff0c;所以就非常依赖这个…

远程工作:自由职业者如何成功赚钱

前言 在这个不断进步的数字化时代&#xff0c;远程工作已经从一个可选的边缘工作方式&#xff0c;成长为主流职业趋势的一部分。特别是自从全球疫情改变了我们的生活和工作方式以来&#xff0c;远程工作的概念不再是遥不可及的理想&#xff0c;而是已经成为许多人日常工作的现…

SpringBoot集成swagger2配置权限认证参数

作者简介&#xff1a;大家好&#xff0c;我是撸代码的羊驼&#xff0c;前阿里巴巴架构师&#xff0c;现某互联网公司CTO 联系v&#xff1a;sulny_ann&#xff08;17362204968&#xff09;&#xff0c;加我进群&#xff0c;大家一起学习&#xff0c;一起进步&#xff0c;一起对抗…

【Lidar】基于Python的三维点云数据转二维平面+散点图绘制

最近一直在搞点云相关的操作&#xff0c;有时候在处理点云数据时需要查看处理后的数据是否满足需求&#xff0c;所以就想着写一套展示点云的代码。之前已经分享过如何可视化点云了&#xff0c;感兴趣的可以自己去看下&#xff1a;【Lidar】基于Python的Open3D库可视化点云数据。…