Mysql进阶-索引-使用规则-索引失效情况二(or连接的条件、数据分布影响)

文章目录

  • 1、or连接的条件
    • 1.1、展示 tb_user 索引
    • 1.2、查询 id=10 or age=23
    • 1.3、执行计划 id=10 or age=23
    • 1.4、给 age 创建 索引
    • 1.4、执行计划 phone='17799990004' or age=23
  • 2、数据分布影响
    • 2.1、查询 tb_user
    • 2.2、查询 phone >='17799990020'
    • 2.3、执行计划 phone >='17799990020'
    • 2.4、执行计划 phone >='17799990000'
    • 2.5、执行计划 phone >='17799990010'
    • 2.6、执行计划 phone >='17799990013'
    • 2.7、执行计划 profession is null
    • 2.8、执行计划 profession is not null
    • 2.9、修改全表 profession=null
    • 2.10、执行计划 profession is null
    • 2.11、执行计划 profession is not null

1、or连接的条件

用or分割开的条件,如果or前的条件中的列有索引,而后面的列中没有索引,那么设计的索引都不会被用到。

1.1、展示 tb_user 索引

mysql> show index from tb_user;
+---------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| Table   | Non_unique | Key_name             | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression |
+---------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| tb_user |          0 | PRIMARY              |            1 | id          | A         |          24 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| tb_user |          0 | idx_user_phone       |            1 | phone       | A         |          24 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_name        |            1 | name        | A         |          24 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_pro_age_sta |            1 | profession  | A         |          16 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_pro_age_sta |            2 | age         | A         |          22 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_pro_age_sta |            3 | status      | A         |          24 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_email            |            1 | email       | A         |          24 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
+---------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
7 rows in set (0.01 sec)

mysql>

age现在只有联合索引,没有单独的索引,也就是单列索引

1.2、查询 id=10 or age=23

mysql> select * from tb_user where id=10 or age=23;
+----+--------+-------------+-------------------+----------------------+------+--------+--------+---------------------+
| id | name   | phone       | email             | profession           | age  | gender | status | createtime          |
+----+--------+-------------+-------------------+----------------------+------+--------+--------+---------------------+
|  1 | 吕布   | 17799990000 | lvbu666@163.com   | 软件工程             |   23 | 1      | 6      | 2001-02-02 00:00:00 |
|  5 | 花木兰 | 17799990004 | 19980729@sina.com | 软件工程             |   23 | 2      | 1      | 2001-04-22 00:00:00 |
| 10 | 白起   | 17799990009 | baiqi666@sina.com | 机械工程及其自动
化 |   27 | 1      | 2      | 2001-08-16 00:00:00 |
+----+--------+-------------+-------------------+----------------------+------+--------+--------+---------------------+
3 rows in set (0.00 sec)

mysql>

1.3、执行计划 id=10 or age=23

mysql> explain select * from tb_user where id=10 or age=23;
+----+-------------+---------+------------+------+---------------+------+---------+------+------+----------+-------------+
| id | select_type | table   | partitions | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+---------+------------+------+---------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | tb_user | NULL       | ALL  | PRIMARY       | NULL | NULL    | NULL |   24 |    13.75 | Using where |
+----+-------------+---------+------------+------+---------------+------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时没有命中索引,因为age没有建立索引

1.4、给 age 创建 索引

mysql> create index idx_user_age on tb_user(age);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show index from tb_user;
+---------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| Table   | Non_unique | Key_name             | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression |
+---------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| tb_user |          0 | PRIMARY              |            1 | id          | A         |          24 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| tb_user |          0 | idx_user_phone       |            1 | phone       | A         |          24 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_name        |            1 | name        | A         |          24 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_pro_age_sta |            1 | profession  | A         |          16 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_pro_age_sta |            2 | age         | A         |          22 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_pro_age_sta |            3 | status      | A         |          24 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_email            |            1 | email       | A         |          24 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
| tb_user |          1 | idx_user_age         |            1 | age         | A         |          19 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
+---------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
8 rows in set (0.01 sec)

mysql>

1.4、执行计划 phone=‘17799990004’ or age=23

mysql> explain select * from tb_user where phone='17799990004' or age=23;
+----+-------------+---------+------------+-------------+-----------------------------+-----------------------------+---------+------+------+----------+-------------------------------------------------------+
| id | select_type | table   | partitions | type        | possible_keys               | key                         | key_len | ref  | rows | filtered | Extra                                                 |
+----+-------------+---------+------------+-------------+-----------------------------+-----------------------------+---------+------+------+----------+-------------------------------------------------------+
|  1 | SIMPLE      | tb_user | NULL       | index_merge | idx_user_phone,idx_user_age | idx_user_phone,idx_user_age | 46,2    | NULL |    3 |   100.00 | Using union(idx_user_phone,idx_user_age); Using where |
+----+-------------+---------+------------+-------------+-----------------------------+-----------------------------+---------+------+------+----------+-------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时索引命中,因为phone和age都有索引

2、数据分布影响

如果MySQL评估使用索引比全表更慢,则不使用索引。

2.1、查询 tb_user

mysql> select * from tb_user;
+----+--------+-------------+-----------------------+----------------------+------+--------+--------+---------------------+
| id | name   | phone       | email                 | profession           | age  | gender | status | createtime          |
+----+--------+-------------+-----------------------+----------------------+------+--------+--------+---------------------+
|  1 | 吕布   | 17799990000 | lvbu666@163.com       | 软件工程             |   23 | 1      | 6      | 2001-02-02 00:00:00 |
|  2 | 曹操   | 17799990001 | caocao666@qq.com      | 通讯工程             |   33 | 1      | 0      | 2001-03-05 00:00:00 |
|  3 | 赵云   | 17799990002 | 17799990@139.com      | 英语                 |   34 | 1      | 2      | 2002-03-02 00:00:00 |
|  4 | 孙悟空 | 17799990003 | 17799990@sina.com     | 工程造价             |   54 | 1      | 0      | 2001-07-02 00:00:00 |
|  5 | 花木兰 | 17799990004 | 19980729@sina.com     | 软件工程             |   23 | 2      | 1      | 2001-04-22 00:00:00 |
|  6 | 大乔   | 17799990005 | daqiao666@sina.com    | 舞蹈                 |   22 | 2      | 0      | 2001-02-07 00:00:00 |
|  7 | 露娜   | 17799990006 | luna_love@sina.com    | 应用数学             |   24 | 2      | 0      | 2001-02-08 00:00:00 |
|  8 | 程咬金 | 17799990007 | chengyaojin@163.com   | 化工                 |   38 | 1      | 5      | 2001-05-23 00:00:00 |
|  9 | 项羽   | 17799990008 | xiaoyu666@qq.com      | 金属材料             |   43 | 1      | 0      | 2001-09-18 00:00:00 |
| 10 | 白起   | 17799990009 | baiqi666@sina.com     | 机械工程及其自动
化 |   27 | 1      | 2      | 2001-08-16 00:00:00 |
| 11 | 韩信   | 17799990010 | hanxin520@163.com     | 无机非金属材料工
程 |   27 | 1      | 0      | 2001-06-12 00:00:00 |
| 12 | 荆轲   | 17799990011 | jingke123@163.com     | 会计                 |   29 | 1      | 0      | 2001-05-11 00:00:00 |
| 13 | 兰陵王 | 17799990012 | lanlinwang666@126.com | 工程造价             |   44 | 1      | 1      | 2001-04-09 00:00:00 |
| 14 | 狂铁   | 17799990013 | kuangtie@sina.com     | 应用数学             |   43 | 1      | 2      | 2001-04-10 00:00:00 |
| 15 | 貂蝉   | 17799990014 | 84958948374@qq.com    | 软件工程             |   40 | 2      | 3      | 2001-02-12 00:00:00 |
| 16 | 妲己   | 17799990015 | 2783238293@qq.com     | 软件工程             |   31 | 2      | 0      | 2001-01-30 00:00:00 |
| 17 | 芈月   | 17799990016 | xiaomin2001@sina.com  | 工业经济             |   35 | 2      | 0      | 2000-05-03 00:00:00 |
| 18 | 嬴政   | 17799990017 | 8839434342@qq.com     | 化工                 |   38 | 1      | 1      | 2001-08-08 00:00:00 |
| 19 | 狄仁杰 | 17799990018 | jujiamlm8166@163.com  | 国际贸易             |   30 | 1      | 0      | 2007-03-12 00:00:00 |
| 20 | 安琪拉 | 17799990019 | jdodm1h@126.com       | 城市规划             |   51 | 2      | 0      | 2001-08-15 00:00:00 |
| 21 | 典韦   | 17799990020 | ycaunanjian@163.com   | 城市规划             |   52 | 1      | 2      | 2000-04-12 00:00:00 |
| 22 | 廉颇   | 17799990021 | lianpo321@126.com     | 土木工程             |   19 | 1      | 3      | 2002-07-18 00:00:00 |
| 23 | 后羿   | 17799990022 | altycj2000@139.com    | 城市园林             |   20 | 1      | 0      | 2002-03-10 00:00:00 |
| 24 | 姜子牙 | 17799990023 | 37483844@qq.com       | 工程造价             |   29 | 1      | 4      | 2003-05-26 00:00:00 |
+----+--------+-------------+-----------------------+----------------------+------+--------+--------+---------------------+
24 rows in set (0.00 sec)

mysql>

2.2、查询 phone >=‘17799990020’


mysql> select * from tb_user where phone >='17799990020';
+----+--------+-------------+---------------------+------------+------+--------+--------+---------------------+
| id | name   | phone       | email               | profession | age  | gender | status | createtime          |
+----+--------+-------------+---------------------+------------+------+--------+--------+---------------------+
| 21 | 典韦   | 17799990020 | ycaunanjian@163.com | 城市规划   |   52 | 1      | 2      | 2000-04-12 00:00:00 |
| 22 | 廉颇   | 17799990021 | lianpo321@126.com   | 土木工程   |   19 | 1      | 3      | 2002-07-18 00:00:00 |
| 23 | 后羿   | 17799990022 | altycj2000@139.com  | 城市园林   |   20 | 1      | 0      | 2002-03-10 00:00:00 |
| 24 | 姜子牙 | 17799990023 | 37483844@qq.com     | 工程造价   |   29 | 1      | 4      | 2003-05-26 00:00:00 |
+----+--------+-------------+---------------------+------------+------+--------+--------+---------------------+
4 rows in set (0.00 sec)

mysql>

2.3、执行计划 phone >=‘17799990020’

mysql> explain select * from tb_user where phone >='17799990020';
+----+-------------+---------+------------+-------+----------------+----------------+---------+------+------+----------+-----------------------+
| id | select_type | table   | partitions | type  | possible_keys  | key            | key_len | ref  | rows | filtered | Extra                 |
+----+-------------+---------+------------+-------+----------------+----------------+---------+------+------+----------+-----------------------+
|  1 | SIMPLE      | tb_user | NULL       | range | idx_user_phone | idx_user_phone | 46      | NULL |    4 |   100.00 | Using index condition |
+----+-------------+---------+------------+-------+----------------+----------------+---------+------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时走索引

2.4、执行计划 phone >=‘17799990000’

mysql> explain select * from tb_user where phone >='17799990000';
+----+-------------+---------+------------+------+----------------+------+---------+------+------+----------+-------------+
| id | select_type | table   | partitions | type | possible_keys  | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+---------+------------+------+----------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | tb_user | NULL       | ALL  | idx_user_phone | NULL | NULL    | NULL |   24 |   100.00 | Using where |
+----+-------------+---------+------------+------+----------------+------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)

此时没有走索引,走的全表扫描

2.5、执行计划 phone >=‘17799990010’

mysql> explain select * from tb_user where phone >='17799990010';
+----+-------------+---------+------------+------+----------------+------+---------+------+------+----------+-------------+
| id | select_type | table   | partitions | type | possible_keys  | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+---------+------------+------+----------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | tb_user | NULL       | ALL  | idx_user_phone | NULL | NULL    | NULL |   24 |    58.33 | Using where |
+----+-------------+---------+------------+------+----------------+------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时没有走索引,走的是全表扫描,因为表中的数据大部分满足phone >='17799990010'

2.6、执行计划 phone >=‘17799990013’

mysql> explain select * from tb_user where phone >='17799990013';
+----+-------------+---------+------------+-------+----------------+----------------+---------+------+------+----------+-----------------------+
| id | select_type | table   | partitions | type  | possible_keys  | key            | key_len | ref  | rows | filtered | Extra                 |
+----+-------------+---------+------------+-------+----------------+----------------+---------+------+------+----------+-----------------------+
|  1 | SIMPLE      | tb_user | NULL       | range | idx_user_phone | idx_user_phone | 46      | NULL |   11 |   100.00 | Using index condition |
+----+-------------+---------+------------+-------+----------------+----------------+---------+------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时命中索引,因为表中的数据很少一部分满足phone >=‘17799990013’所以走索引更快

2.7、执行计划 profession is null

mysql> explain select * from tb_user where profession is null;
+----+-------------+---------+------------+------+----------------------+----------------------+---------+-------+------+----------+-----------------------+
| id | select_type | table   | partitions | type | possible_keys        | key                  | key_len | ref   | rows | filtered | Extra                 |
+----+-------------+---------+------------+------+----------------------+----------------------+---------+-------+------+----------+-----------------------+
|  1 | SIMPLE      | tb_user | NULL       | ref  | idx_user_pro_age_sta | idx_user_pro_age_sta | 47      | const |    1 |   100.00 | Using index condition |
+----+-------------+---------+------------+------+----------------------+----------------------+---------+-------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时命中索引,因为表中的数据都不是null,所以走索引更快

2.8、执行计划 profession is not null

mysql> explain select * from tb_user where profession is not null;
+----+-------------+---------+------------+------+----------------------+------+---------+------+------+----------+-------------+
| id | select_type | table   | partitions | type | possible_keys        | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+---------+------------+------+----------------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | tb_user | NULL       | ALL  | idx_user_pro_age_sta | NULL | NULL    | NULL |   24 |   100.00 | Using where |
+----+-------------+---------+------------+------+----------------------+------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)

mysql>

此时不走索引,因为表中的数据大多数都不是空,走全表扫描要更快

2.9、修改全表 profession=null

mysql> update tb_user set profession=null;
Query OK, 24 rows affected (0.01 sec)
Rows matched: 24  Changed: 24  Warnings: 0

mysql> select * from tb_user;
+----+--------+-------------+-----------------------+------------+------+--------+--------+---------------------+
| id | name   | phone       | email                 | profession | age  | gender | status | createtime          |
+----+--------+-------------+-----------------------+------------+------+--------+--------+---------------------+
|  1 | 吕布   | 17799990000 | lvbu666@163.com       | NULL       |   23 | 1      | 6      | 2001-02-02 00:00:00 |
|  2 | 曹操   | 17799990001 | caocao666@qq.com      | NULL       |   33 | 1      | 0      | 2001-03-05 00:00:00 |
|  3 | 赵云   | 17799990002 | 17799990@139.com      | NULL       |   34 | 1      | 2      | 2002-03-02 00:00:00 |
|  4 | 孙悟空 | 17799990003 | 17799990@sina.com     | NULL       |   54 | 1      | 0      | 2001-07-02 00:00:00 |
|  5 | 花木兰 | 17799990004 | 19980729@sina.com     | NULL       |   23 | 2      | 1      | 2001-04-22 00:00:00 |
|  6 | 大乔   | 17799990005 | daqiao666@sina.com    | NULL       |   22 | 2      | 0      | 2001-02-07 00:00:00 |
|  7 | 露娜   | 17799990006 | luna_love@sina.com    | NULL       |   24 | 2      | 0      | 2001-02-08 00:00:00 |
|  8 | 程咬金 | 17799990007 | chengyaojin@163.com   | NULL       |   38 | 1      | 5      | 2001-05-23 00:00:00 |
|  9 | 项羽   | 17799990008 | xiaoyu666@qq.com      | NULL       |   43 | 1      | 0      | 2001-09-18 00:00:00 |
| 10 | 白起   | 17799990009 | baiqi666@sina.com     | NULL       |   27 | 1      | 2      | 2001-08-16 00:00:00 |
| 11 | 韩信   | 17799990010 | hanxin520@163.com     | NULL       |   27 | 1      | 0      | 2001-06-12 00:00:00 |
| 12 | 荆轲   | 17799990011 | jingke123@163.com     | NULL       |   29 | 1      | 0      | 2001-05-11 00:00:00 |
| 13 | 兰陵王 | 17799990012 | lanlinwang666@126.com | NULL       |   44 | 1      | 1      | 2001-04-09 00:00:00 |
| 14 | 狂铁   | 17799990013 | kuangtie@sina.com     | NULL       |   43 | 1      | 2      | 2001-04-10 00:00:00 |
| 15 | 貂蝉   | 17799990014 | 84958948374@qq.com    | NULL       |   40 | 2      | 3      | 2001-02-12 00:00:00 |
| 16 | 妲己   | 17799990015 | 2783238293@qq.com     | NULL       |   31 | 2      | 0      | 2001-01-30 00:00:00 |
| 17 | 芈月   | 17799990016 | xiaomin2001@sina.com  | NULL       |   35 | 2      | 0      | 2000-05-03 00:00:00 |
| 18 | 嬴政   | 17799990017 | 8839434342@qq.com     | NULL       |   38 | 1      | 1      | 2001-08-08 00:00:00 |
| 19 | 狄仁杰 | 17799990018 | jujiamlm8166@163.com  | NULL       |   30 | 1      | 0      | 2007-03-12 00:00:00 |
| 20 | 安琪拉 | 17799990019 | jdodm1h@126.com       | NULL       |   51 | 2      | 0      | 2001-08-15 00:00:00 |
| 21 | 典韦   | 17799990020 | ycaunanjian@163.com   | NULL       |   52 | 1      | 2      | 2000-04-12 00:00:00 |
| 22 | 廉颇   | 17799990021 | lianpo321@126.com     | NULL       |   19 | 1      | 3      | 2002-07-18 00:00:00 |
| 23 | 后羿   | 17799990022 | altycj2000@139.com    | NULL       |   20 | 1      | 0      | 2002-03-10 00:00:00 |
| 24 | 姜子牙 | 17799990023 | 37483844@qq.com       | NULL       |   29 | 1      | 4      | 2003-05-26 00:00:00 |
+----+--------+-------------+-----------------------+------------+------+--------+--------+---------------------+
24 rows in set (0.00 sec)

mysql>

2.10、执行计划 profession is null

mysql> explain select * from tb_user where profession is null;
+----+-------------+---------+------------+------+----------------------+------+---------+------+------+----------+-------------+
| id | select_type | table   | partitions | type | possible_keys        | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+---------+------------+------+----------------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | tb_user | NULL       | ALL  | idx_user_pro_age_sta | NULL | NULL    | NULL |   24 |   100.00 | Using where |
+----+-------------+---------+------------+------+----------------------+------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)

mysql>

2.11、执行计划 profession is not null

mysql> explain select * from tb_user where profession is not null;
+----+-------------+---------+------------+-------+----------------------+----------------------+---------+------+------+----------+-----------------------+
| id | select_type | table   | partitions | type  | possible_keys        | key                  | key_len | ref  | rows | filtered | Extra                 |
+----+-------------+---------+------------+-------+----------------------+----------------------+---------+------+------+----------+-----------------------+
|  1 | SIMPLE      | tb_user | NULL       | range | idx_user_pro_age_sta | idx_user_pro_age_sta | 47      | NULL |    1 |   100.00 | Using index condition |
+----+-------------+---------+------------+-------+----------------------+----------------------+---------+------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec)

mysql>

在这里插入图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Java 自定义jackson2序列化器遇到的问题

问题1:java: 错误: 不支持发行版本 5 修改idea java环境 问题2:ClassNotFoundException: com.fasterxml.jackson.annotation.JsonMerge 缺少 jar 包:jackson-annotations 引入依赖的地址:https://mvnrepository.com/artifact/c…

【深度学习】【Lora训练3】StabelDiffusion,Lora训练过程,秋叶包,Linux,SDXL Lora训练

为了便于使用,构建一个docker镜像来使用秋叶包。2024年6月26日。 docker run -it --gpus all -v /ssd/xiedong:/datax --net host kevinchina/deeplearning:pytorch2.3.0-cuda12.1-cudnn8-devel-xformers bashgit clone --recurse-submodules https://github.com/A…

如何实现智慧农田的精准灌溉

如何实现智慧农田的精准灌溉 智慧农田的精准灌溉是现代农业技术发展的重要组成部分,它集成了物联网、大数据分析、人工智能以及现代水利技术,旨在通过实时监测土壤湿度、气象条件及作物生长状况,实现水资源的高效利用和作物产量、品质的双重…

学习记录698@基带传输和频带传输基础

还是在学习计算机网络物理层时遇到这些知识点,这里简单的记录一下,主要都是通信专业的知识 基带传输 信源发出的原始信号叫做基带信号,基带信号分为模拟基带信号与数字基带信号。基带信号一般是低频成分,适合在具有低通特性的有…

使用uniapp.pageScrollTo方法进行页面滚动

先看看是不是你想要的: 需求: 有个填写数据的单子在提交的时候,会对必填项做校验,如果必填项没有数据的话,必填项校验生效给出提示,并且页面滚动到第一个需要填写数据的地方。 开发: 因为这个…

flutter是app跨平台最优解吗?

哈喽,我是老刘 最近在知乎上看到这样一个问题 我们先来解释一下问题中碰到的几个现象的可能原因,然后聊聊跨平台的最优解问题 问题解释 1、跟手、丝滑问题 这个问题其实很多人是有误解的,觉得原生的就丝滑跟手 其实不是这样的 我在做Flut…

一键生成AI动画视频?Animatediff 和 ComfyUI 更配哦!

大家好我是极客菌! 之前我分享过 Animatediff 在 WebUI 中的应用,最近不是在分享 ComfyUI 嘛,那我们也来讲讲 Animatediff 在 ComfyUI 的应用。 如果从工作流和内存利用率的角度来说,Animatediff 和 ComfyUI 可能更配一些&#…

Python 语法基础二

7.常用内置函数 执行这个命令可以查看所有内置函数和内置对象(两个下划线) >>>dir(__builtins__) [__class__, __contains__, __delattr__, __delitem__, __dir__, __doc__, __eq__, __format__, __ge__, __getattribute__, __getitem__, __gt…

API-元素尺寸与位置

学习目标: 掌握元素尺寸与位置 学习内容: 元素尺寸与位置仿京东固定导航栏案例实现bilibili点击小滑块移动效果 元素尺寸与位置: 使用场景: 前面案例滚动多少距离,都是我们自己算的,最好是页面滚动到某个…

【研究】美国2023年就业增长可能是假的?加州已经爆出大雷

美国就业市场可能比火热的非农数据所描绘的场面惨淡得多。 去年以来,美国劳动力市场顶着二十多年来最高的利率一路高歌猛进,让许多市场分析人士开始怀疑数据的准确性。尽管官方报告显示就业形势向好,但越来越多的证据表明,实际情…

校园圈子小程序系统搭建需求和需要哪些功能?APP小程序H5前后端源码交付

功能:小程序授权登陆,支持app双端,小程序,h5,pc端,手机号登陆,发帖,建圈子、发活动。可置顶推荐帖子,关注、粉 丝、点赞等。可作为圈子贴吧、小红书、校园社区、表白墙、…

韩国锂电池工厂火灾:行业安全警钟再次敲响

三天前,6月24日上午,韩国京畿道华城市一电池厂突发火灾,造成严重人员伤亡,其中包括多名中国籍员工。这一事件不仅令人痛心,更为全球锂电池行业安全敲响了警钟。 事发当天,电池厂内堆放锂电池成品的区域突然…

深度神经网络(dnn)--风格迁移(简单易懂)

概括 深度神经网络(DNN)在风格迁移领域的应用,实现了将一幅图像的艺术风格迁移到另一幅图像上的目标。该技术基于深度学习模型,特别是卷积神经网络(CNN),通过提取内容图像的内容特征和风格图像的…

CAD2012 网络许可和单机切换

由于公司使用的CAD2012 是网络租借许可的方式,如果许可有限,使用人数比许可数多,就会出现争抢问题。出现有些人得不到许可(遇到公司不增加许可真的很坑B,因为A抢上了可能C被迫掉了,C上去O可能掉&#xff0c…

Oracle 19C19.3 rac安装并RU升级到19.14

19C支持RU补丁安装。 下载好19.14的RU补丁 [rootrac1 soft]# ll total 9830404 -rw-r--r-- 1 grid oinstall 3059705302 Jun 18 15:26 LINUX.X64_193000_db_home.zip -rw-r--r-- 1 grid oinstall 2889184573 Jun 18 15:27 LINUX.X64_193000_grid_home.zip -rw-r--r-- 1 grid …

2024肥晨赠书活动第三期:《前端工程化:基于Vue.js 3.0的设计与实践》

文章目录 内容简介作者简介关于《前端工程化:基于Vue.js 3.0的设计与实践》文章目录文章简介《前端工程化:基于Vue.js 3.0的设计与实践》全书速览结束语 内容简介 本书以Vue.js的3.0版本为核心技术栈,围绕“前端工程化”和TypeScript的知识点…

昇思25天学习打卡营第1天|快速入门-Mnist手写数字识别

学习目标:熟练掌握MindSpore使用方法 学习心得体会,记录时间 了解MindSpore总体架构 学会使用MindSpore 简单应用时间-手写数字识别 一、MindSpore总体架构 华为MindSpore为全场景深度学习框架,开发高效,全场景统一部署特点。 …

将huggingface的大模型转换为safetensor格式

很多huggingface的大语言模型都是pytorch的格式,但是mindie需要safetensor格式,另外mindieservice加载原始的baichuan2-13b的模型出错,后来排查是bfloat16数据格式的问题,所以这次转换要一次性转为float16的格式。 上代码&#x…

在Ubuntu22.04 使用stable-diffusion-webui 秋叶整合包

背景 众所周知,赛博菩萨已经发布了windows下的整合包,开箱即用,且集成度较高。 那我为啥非要在Ubuntu下使用呢? 当然是因为主力机就是Ubuntu系统啦。而且涉及到sd webui API 的调用,在Ubuntu 下调试更加方便一点。 那…

SyntaxError: Unexpected token ‘<‘ (at chunk-vendors.fb93d34e.js:1:1)打包后页面白屏vue

本地运行一切正常,打包到线上,页面一篇空白。我确定输入路径正确。。。 控制台报错,我就开始百度,有的说清空缓存就行了,但我清空了还是这样。。。 然后我就去排查原因。看到页面请求js,但是请求的好像有点…