MySQL前缀索引上限案例分析

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 某些时候由于前期字段长度无规划、或者业务本身字段长度有要求,我们想对这些字段添加索引时却报错“超过索引长度”,针对这类问题我们该如何处理?背后原理又是什么呢?

一、案例分享

1.1 问题描述

以下一例报错是开发同学通过框架初始化创建一些表结构时出现的报错,我们需要重点关注“1071 Specified key was too long; max key length is 7671071 Specified key was too long; max key length is 767 bytes”这个提示。该报错告诉我们索引长度超过的额767,因过长而无法创建索引。这也是为什么经常在一些MySQL的SQL审批中,DBA同学会经常要求某个表的字段长度尽量不要超过191、某些表的字段长度不要超过255。

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes in /var/www/html/includes/vendor/aura/sql/src/ExtendedPdo.php:748 Stack trace: #0 /var/www/html/includes/vendor/aura/sql/src/ExtendedPdo.php(748): PDOStatement->execute() #1 /var/www/html/includes/functions-install.php(252): Aura\Sql\ExtendedPdo->perform('CREATE TABLE IF...') #2 /var/www/html/admin/install.php(46): yourls_create_sql_tables() #3 {main} thrown in /var/www/html/includes/vendor/aura/sql/src/ExtendedPdo.php on line 748

MySQL中索引长度主要受什么的限制呢?是否可以把767的限制进行放宽?

1.2 问题处理

1、查看数据库innodb_file_format、innodb_large_prefix参数

innodb_file_format=Barracuda
innodb_large_prefix=OFF

2、查看innodb_default_row_format参数

innodb_default_row_format=Compact
由于业务方使用的MySQL是5.6版本,所有表默认ROW_FORMAT=Compact。

3、通过以上3个参数,况基本明了,目前的解决办法有3种:

1.改表结构,字段长度可以缩小的话就缩小,utf8255,utf8mbe191.
2.建表语句添加ROW_FORMAT=DYNAMIC
3.线上使用5.7版本的数据库

二、MySQL前缀索引上的一些限制

image

2.1 Redundant

1、row_format=redundant要求innodb_file_format=Barracuda/Antelope。

2、该行模式下,对于可变长字段,innodb会存储其起始的768字节在B-tree的节点中,超出部分存储在溢出页中。对于长度小于768字节的字段,其信息全部存储在B-tree节点中。这对于长度较小的大字段来说是比较有利的,可以减小数据查询时的IO消耗。若表有有较多的大字段,就会造成b-tree中存储大量的数据,每页存储的行数也就相应的变少,从而导致我们索引查询效率变低。

3、redundant行模式下,字段索引长度需小于768字节,不支持对前缀索引长度的扩大。对于utf8字符集格式的字段,每3个字节为一个字符;对于utf8mb4字符集格式的字段,每4个字节为一个字符;对于latin1字符集格式的字段,每1个字节为一个字符

+--------------+---------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name          | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+---------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_redundant_latin1  | InnoDB | Redundant  | latin1             | name        |                      768 |                    768 |
| db1          | t_redundant_utf8    | InnoDB | Redundant  | utf8               | name        |                      256 |                    768 |
| db1          | t_redundant_utf8mb4 | InnoDB | Redundant  | utf8mb4            | name        |                      192 |                    768 |
+--------------+---------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
sansi@mysql 11:41:  [db1]> alter table t_redundant_utf8 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
sansi@mysql 11:41:  [db1]> alter table t_redundant_utf8mb4 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
sansi@mysql 12:09:  [db1]> alter table t_redundant_latin1 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes


+--------------+---------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name          | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+---------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_redundant_latin1  | InnoDB | Redundant  | latin1             | name        |                      767 |                    767 |
| db1          | t_redundant_utf8    | InnoDB | Redundant  | utf8               | name        |                      255 |                    765 |
| db1          | t_redundant_utf8mb4 | InnoDB | Redundant  | utf8mb4            | name        |                      191 |                    764 |
+--------------+---------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
sansi@mysql 11:43:  [db1]> alter table t_redundant_utf8 add index idx_name(name);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 11:43:  [db1]> alter table t_redundant_utf8mb4 add index idx_name(name);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 12:15:  [db1]> alter table t_redundant_latin1 add index idx_name(name);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

2.2 compact

1、compact行模式相对于redundant来说可以节省20%的空间,但是会增加一些CPU的消耗。MySQL5.6的默认行模式,row_format=compact要求innodb_file_format=Barracuda/Antelope。

2、该行模式下,对于可变长字段,innodb会存储其起始的768字节在B-tree的节点中,超出部分存储在溢出页中。对于长度小于768字节的字段,其信息全部存储在B-tree节点中。这对于长度较小的大字段来说是比较有利的,可以减小数据查询时的IO消耗。若表有有较多的大字段,就会造成b-tree中存储大量的数据,每页存储的行数也就相应的变少,从而导致我们索引查询效率变低。

3、compact行模式下,字段索引长度需小于768字节,不支持对前缀索引长度的扩大。对于utf8字符集格式的字段,每3个字节为一个字符;对于utf8mb4字符集格式的字段,每4个字节为一个字符;对于latin1字符集格式的字段,每1个字节为一个字符

+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name        | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_compact_latin1  | InnoDB | Compact    | latin1             | name        |                      768 |                    768 |
| db1          | t_compact_utf8    | InnoDB | Compact    | utf8               | name        |                      256 |                    768 |
| db1          | t_compact_utf8mb4 | InnoDB | Compact    | utf8mb4            | name        |                      192 |                    768 |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
sansi@mysql 12:26:  [db1]> alter table t_compact_latin1 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
sansi@mysql 12:26:  [db1]> alter table t_compact_utf8 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
sansi@mysql 12:26:  [db1]> alter table t_compact_utf8mb4 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes


+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name        | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_compact_latin1  | InnoDB | Compact    | latin1             | name        |                      767 |                    767 |
| db1          | t_compact_utf8    | InnoDB | Compact    | utf8               | name        |                      255 |                    765 |
| db1          | t_compact_utf8mb4 | InnoDB | Compact    | utf8mb4            | name        |                      191 |                    764 |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
sansi@mysql 12:24:  [db1]> alter table t_compact_latin1 add index idx_name(name);
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 12:25:  [db1]> alter table t_compact_utf8 add index idx_name(name);
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 12:25:  [db1]> alter table t_compact_utf8mb4 add index idx_name(name);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

2.3 dynamic

1、dynamic在空间存储上与compact格式相同,额外增加的一个特性是针对可变长度的字段的溢出页存储技术,dynamic模式下使用的是完全溢出页存储。row_format=dynamic是MySQL5.7的默认值。要求innodb_file_format=Barracuda

2、该行模式下,使用完全溢出页进行存储,其聚集索引仅仅保存一个20字节的指针指向溢出页。其存储是否需要使用溢出页取决于数据页大小和行大小,较短的字段字节存储在b-tree中,较长的字段将整个值存储在溢出页,并使用指针进行关联。

3、dynamic行模式下,可以将索引前缀限制由之前的768提升至3072。对于utf8字符集格式的字段,每3个字节为一个字符;对于utf8mb4字符集格式的字段,每4个字节为一个字符;对于latin1字符集格式的字段,每1个字节为一个字符

1)满足索引前缀提升至3072需要关注以下几个参数

innodb_file_format=Barracuda
row_format=dynamic
innodb_file_per_table=on
innodb_large_prefix=on

2)示例

+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name        | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_dynamic_latin1  | InnoDB | Dynamic    | latin1             | name        |                     3073 |                   3073 |
| db1          | t_dynamic_utf8    | InnoDB | Dynamic    | utf8               | name        |                     1025 |                   3075 |
| db1          | t_dynamic_utf8mb4 | InnoDB | Dynamic    | utf8mb4            | name        |                      769 |                   3076 |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
3 rows in set (0.03 sec)
sansi@mysql 15:20:  [db1]> alter table t_dynamic_utf8 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
sansi@mysql 15:20:  [db1]> alter table t_dynamic_utf8mb4 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
sansi@mysql 15:20:  [db1]> alter table t_dynamic_latin1 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes

+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name        | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_dynamic_latin1  | InnoDB | Dynamic    | latin1             | name        |                     3072 |                   3072 |
| db1          | t_dynamic_utf8    | InnoDB | Dynamic    | utf8               | name        |                     1024 |                   3072 |
| db1          | t_dynamic_utf8mb4 | InnoDB | Dynamic    | utf8mb4            | name        |                      768 |                   3072 |
+--------------+-------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+

sansi@mysql 15:17:  [db1]> alter table t_dynamic_latin1 add index idx_name(name);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 15:18:  [db1]> alter table t_dynamic_utf8mb4 add index idx_name(name);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 15:19:  [db1]> alter table t_dynamic_utf8 add index idx_name(name);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

2.4 compressed

1、compressed是在dynamic的基础上,额外增强了对索引和数据的压缩,row_format=comPRESSED要求innodb_file_format=Barracuda

2、该行模式下,使用完全溢出页进行存储,其聚集索引仅仅保存一个20字节的指针指向溢出页。其存储是否需要使用溢出页取决于数据页大小和行大小,较短的字段字节存储在b-tree中,较长的字段将整个值存储在溢出页,并使用指针进行关联。

3、dynamic行模式下,可以将索引前缀限制由之前的768提升至3072。对于utf8字符集格式的字段,每3个字节为一个字符;对于utf8mb4字符集格式的字段,每4个字节为一个字符;对于latin1字符集格式的字段,每1个字节为一个字符

1)满足索引前缀提升至3072需要关注以下几个参数

innodb_file_format=Barracuda
row_format=dynamic
innodb_file_per_table=on
innodb_large_prefix=on

2)示例

+--------------+----------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name           | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+----------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_compressed_latin1  | InnoDB | Compressed | latin1             | name        |                     3073 |                   3073 |
| db1          | t_compressed_utf8    | InnoDB | Compressed | utf8               | name        |                     1025 |                   3075 |
| db1          | t_compressed_utf8mb4 | InnoDB | Compressed | utf8mb4            | name        |                      769 |                   3076 |
+--------------+----------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
sansi@mysql 15:33:  [db1]> alter table t_compressed_utf8mb4 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
sansi@mysql 15:35:  [db1]> alter table t_compressed_utf8 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
sansi@mysql 15:35:  [db1]> alter table t_compressed_latin1 add index idx_name(name);
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes

+--------------+----------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| table_schema | table_name           | engine | row_format | CHARACTER_SET_NAME | COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
+--------------+----------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
| db1          | t_compressed_latin1  | InnoDB | Compressed | latin1             | name        |                     3071 |                   3071 |
| db1          | t_compressed_utf8    | InnoDB | Compressed | utf8               | name        |                     1024 |                   3072 |
| db1          | t_compressed_utf8mb4 | InnoDB | Compressed | utf8mb4            | name        |                      768 |                   3072 |
+--------------+----------------------+--------+------------+--------------------+-------------+--------------------------+------------------------+
sansi@mysql 15:36:  [db1]>
sansi@mysql 15:36:  [db1]> alter table t_compressed_utf8mb4 add index idx_name(name);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 15:36:  [db1]> alter table t_compressed_utf8 modify name varchar(1024);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0
sansi@mysql 15:36:  [db1]> alter table t_compressed_latin1 modify name varchar(3071);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

三、MySQL表字段上的一些限制

3.1、列与数据类型间的限制

1) char

char为定长字段,可存储长度为0~255,当sql_mode为STRICT_TRANS_TABLES时,N大于255时直接返回报错

sansi@mysql 15:46:  [db1]> create table t1 (c1 char(256));
ERROR 1074 (42000): Column length too big for column 'c1' (max = 255); use BLOB or TEXT instead

2) varchar

varchar为可变长字段,可存储的长度为0~65535字节,N具体大小限制需要根据列字符集格式进行判断:lantin1=1字节,utf8=3字节,utf8mb4=4字节。

65535/3=21845
sansi@mysql 15:46:  [db1]> create table t1 (c1 varchar(65535) not null) character set utf8;
ERROR 1074 (42000): Column length too big for column 'c1' (max = 21845); use BLOB or TEXT instead   
65535/4=16383
sansi@mysql 15:47:  [db1]> create table t1 (c1 varchar(65535) not null) character set utf8mb4;
ERROR 1074 (42000): Column length too big for column 'c1' (max = 16383); use BLOB or TEXT instead
65533 + 2
sansi@mysql 15:47:  [db1]> create table t1 (c1 varchar(65533) not null) character set latin1;
Query OK, 0 rows affected (0.02 sec)

3.2、列总数限制

MySQL表中所有的列总和不能超过4096,当然一些别的条件的限制下,表的列总数一般不会达到该限制条件

1)受到表的最大row size的限制

2)存储引擎的限制

3)每个表的.frm文件的限制

3.3、row size限制

1)MySQL默认一个表的row size最大为65535,即使存储引擎支持更大的row size。

sansi@mysql 15:49:  [db1]> CREATE TABLE t (a VARCHAR(10000), b VARCHAR(10000), c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000), f VARCHAR(10000), g VARCHAR(6000)) ENGINE=InnoDB CHARACTER SET latin1;
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

sansi@mysql 15:49:  [db1]> CREATE TABLE t (a VARCHAR(10000), b VARCHAR(10000),  c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000),  f VARCHAR(10000), g VARCHAR(6000)) ENGINE=MyISAM CHARACTER SET latin1;
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

2)bolb和text列仅占row size的9~12 bytes,因为blob和text使用off-page进行存储。对于Innodb存储引擎来讲,可变长列的存储超过767 bytes是利用溢出页来存储的。

sansi@mysql 15:49:  [db1]>  CREATE TABLE t (a VARCHAR(10000), b VARCHAR(10000),
    ->  c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000),
    ->  f VARCHAR(10000), g TEXT(6000)) ENGINE=MyISAM CHARACTER SET latin1;
Query OK, 0 rows affected (0.01 sec)

sansi@mysql 15:53:  [db1]>  CREATE TABLE t (a VARCHAR(10000), b VARCHAR(10000),
    ->  c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000),
    ->  f VARCHAR(10000), g TEXT(6000)) ENGINE=InnoDB CHARACTER SET latin1;
Query OK, 0 rows affected (0.03 sec)

对于可变长列的存储,Innodb除了行记录的存储外,还需要额外的空间来存储该行记录的实际大小。767 bytes以下只需一个字节,767 bytes以上需要两个字节来存储。

1、c1列 65535 + 2 = 65537 > 65535    执行报错
sansi@mysql 15:59:  [db1]> CREATE TABLE t1
    -> (c1 VARCHAR(65535) NOT NULL)
    -> ENGINE = InnoDB CHARACTER SET latin1;
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

2、c1列 65533 + 2 = 65535 <= 65535    执行成功
sansi@mysql 15:59:  [db1]> CREATE TABLE t1
    -> (c1 VARCHAR(65533) NOT NULL)
    -> ENGINE = InnoDB CHARACTER SET latin1;
Query OK, 0 rows affected (0.03 sec)
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7天前
|
存储 SQL 关系型数据库
MySQL 进阶使用【函数、索引、视图、存储过程、存储函数、触发器】(2)
MySQL 进阶使用【函数、索引、视图、存储过程、存储函数、触发器】
|
7天前
|
存储 SQL 关系型数据库
MySQL 进阶使用【函数、索引、视图、存储过程、存储函数、触发器】(1)
MySQL 进阶使用【函数、索引、视图、存储过程、存储函数、触发器】
|
1天前
|
存储 关系型数据库 MySQL
MySQL索引18连问,谁能顶住
MySQL索引18问概览: 1. 索引是提升查询速度的数据结构,如书的目录。 2. 索引类型包括B+tree、Hash、Full-text、R-Tree等,B+tree擅长范围查询,Hash擅长等值比较。 3. 主键索引唯一且不可为空,每表只能一个;唯一索引允许唯一值,可为空。 4. 聚簇索引数据与索引顺序一致,非聚簇索引存储指针。
155 0
MySQL索引18连问,谁能顶住
|
2天前
|
关系型数据库 MySQL 数据库
mysql索引优化
【6月更文挑战第16天】mysql索引优化
5 2
|
3天前
|
存储 关系型数据库 MySQL
MySQL索引的限制
【6月更文挑战第15天】MySQL索引的限制
6 3
|
3天前
|
监控 关系型数据库 MySQL
MySQL索引的创建步骤是什么?
【6月更文挑战第15天】MySQL索引的创建步骤是什么?
10 5
|
3天前
|
存储 关系型数据库 MySQL
MySQL索引
【6月更文挑战第15天】MySQL索引
8 3
|
4天前
|
SQL 关系型数据库 MySQL
MySQL数据库基础练习系列8、成绩录入与分析系统
MySQL数据库基础练习系列8、成绩录入与分析系统
11 1
|
4天前
|
SQL 存储 关系型数据库
MySQL存储过程——Baidu Comate智能代码助手添加20条DML语句——测试索引效果
MySQL存储过程——Baidu Comate智能代码助手添加20条DML语句——测试索引效果
5 0
|
5天前
|
SQL 关系型数据库 MySQL
【MySQL技术内幕】5.6-B+树索引的使用
【MySQL技术内幕】5.6-B+树索引的使用
16 4