mysql索引
2021/9/22 19:10:18
本文主要是介绍mysql索引,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
索引
https://www.bilibili.com/video/BV12b411K7Zu?p=334&spm_id_from=pageDriver P333 P334 索引相关
B tree:
1、数据 2、向下指针 3、指向数据指针
B+ Tree
1、数据 2、向下指针 3、数据指针在叶子节点
#查看索引 show index from table_name; mysql> show index from user; +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+-- | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | N +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+-- | user | 0 | PRIMARY | 1 | Host | A | 3 | NULL | NULL | | user | 0 | PRIMARY | 2 | User | A | 6 | NULL | NULL | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+- #创建索引 create index idx_name on table_name(name1,name2,name3); mysql> create index idx_a on t(a); Query OK, 0 rows affected (0.32 sec) Records: 0 Duplicates: 0 Warnings: 0 alter table table_name add primary key(column_list) ; mysql> alter table t add primary key(a) ; Query OK, 3 rows affected (1.27 sec) Records: 3 Duplicates: 0 Warnings: 0
这篇关于mysql索引的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-02MySQL 3主集群搭建
- 2024-12-25如何部署MySQL集群资料:新手入门教程
- 2024-12-24MySQL集群部署资料:新手入门教程
- 2024-12-24MySQL集群资料详解:新手入门教程
- 2024-12-24MySQL集群部署入门教程
- 2024-12-24部署MySQL集群学习:新手入门教程
- 2024-12-24部署MySQL集群入门:一步一步搭建指南
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解