当前位置:网站首页>Mysql database indexing tutorial (super detailed)
Mysql database indexing tutorial (super detailed)
2022-07-05 18:46:00 【InfoQ】
Index preliminary
shortcoming
Index structure

Experiment preparation ( The following experiments are VMware In the middle of )
1、 Create a new database
create database test default character set utf8;
2、 Create a new data table
CREATE TABLE testsql (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY comment ' Since the primary key ',
dept tinyint not null comment ' department id',
name varchar(30) comment ' User name ',
create_time datetime not null comment ' Registration time ',
last_login_time datetime comment ' Last login time '
) comment ' The test table ';
3、 Write data
insert into testsql values(1,1,'user_1', '2018-01-01 00:00:00', '2018-03-01 12:00:00');
4、 assignment
set @i=1;
5、 Make a table with multiple increase ( Otherwise, tens of millions of data can't be written in a year )
insert into testsql(dept, name, create_time, last_login_time)
select left(rand()*10,1) as dept, # Random generation 1~10 The integer of
concat('user_',@i:[email protected]+1), # Generate different... In sequence name
date_add(create_time,interval [email protected]*cast(rand()*100 as signed) SECOND), # Generate random registration time with time sequence
date_add(date_add(create_time,interval [email protected]*cast(rand()*100 as signed) SECOND), interval + cast(rand()*1000000 as signed) SECOND) # Generate a random last login time with a time sequence
from testsql;
6、 see
select count(*) from testsql;
show variables like "%_buffer%";
7、 experiment
select COUNT(*) from t where name='user_500000';
8、 Create index




9、 Experimental results
select COUNT(*) from t where name='user_500000';
边栏推荐
- How to choose the most formal and safe external futures platform?
- sample_ What is the relationship between rate, sample and duration
- 集合处理的利器
- 如何写出好代码 - 防御式编程
- c期末复习
- Icml2022 | partial and asymmetric comparative learning of out of distribution detection in long tail recognition
- 7-1 linked list is also simple fina
- 关于服装ERP,你想知道的都在这里了
- 使用JMeter录制脚本并调试
- ICML2022 | 长尾识别中分布外检测的部分和非对称对比学习
猜你喜欢

AI Open2022|基于异质信息网络的推荐系统综述:概念,方法,应用与资源
![[detailed explanation of AUTOSAR 14 startup process]](/img/c4/5b08b43db97d8bb10c7207005f8c0a.png)
[detailed explanation of AUTOSAR 14 startup process]

视频自监督学习综述

Case sharing | integrated construction of data operation and maintenance in the financial industry

How to obtain the coordinates of the aircraft passing through both ends of the radar

Various pits of vs2017 QT

The 11th China cloud computing standards and Applications Conference | cloud computing national standards and white paper series release, and Huayun data fully participated in the preparation

Use of websocket tool

LeetCode 6111. Spiral matrix IV

Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接
随机推荐
MySQL优化六个点的总结
MySQL数据库索引教程(超详细)
Electron installation problems
The origin of PTS, DTS and duration of audio and video packages
The main thread anr exception is caused by too many binder development threads
如何获取飞机穿过雷达两端的坐标
7-1 linked list is also simple fina
C language makes it easy to add, delete, modify and check the linked list "suggested collection"
蚂蚁集团开源可信隐私计算框架「隐语」:开放、通用
企业级数据安全,天翼云是这样理解的
Idea configuring NPM startup
Case sharing | integrated construction of data operation and maintenance in the financial industry
一朵云开启智慧交通新未来
Use of websocket tool
[HCIA cloud] [1] definition of cloud computing, what is cloud computing, architecture and technical description of cloud computing, Huawei cloud computing products, and description of Huawei memory DD
Solutions contents have differences only in line separators
Is it complicated to open an account? Is online account opening safe?
Oracle日期格式转换 to_date,to_char,to_timetamp 相互转换
What are the cache interfaces of nailing open platform applet API?
ROS installation error sudo: rosdep: command not found