当前位置:网站首页>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';
边栏推荐
猜你喜欢
Ant group open source trusted privacy computing framework "argot": open and universal
Thoroughly understand why network i/o is blocked?
Overview of video self supervised learning
The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
LeetCode 6111. Spiral matrix IV
2022最新中高级Android面试题目,【原理+实战+视频+源码】
AI open2022 | overview of recommendation systems based on heterogeneous information networks: concepts, methods, applications and resources
Oracle日期格式转换 to_date,to_char,to_timetamp 相互转换
Isprs2022/ cloud detection: cloud detection with boundary nets
U-Net: Convolutional Networks for Biomedical Images Segmentation
随机推荐
The main thread anr exception is caused by too many binder development threads
图扑软件数字孪生智慧风电系统
Copy the linked list with random pointer in the "Li Kou brush question plan"
5. 数据访问 - EntityFramework集成
在通达信上做基金定投安全吗?
c期末复习
FCN: Fully Convolutional Networks for Semantic Segmentation
【Autosar 十四 启动流程详解】
The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
Problems encountered in the project u-parse component rendering problems
Insufficient picture data? I made a free image enhancement software
鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!
Einstein sum einsum
金太阳开户安全吗?万一免5开户能办理吗?
Shang Silicon Valley Shang preferred project tutorial release
How to obtain the coordinates of the aircraft passing through both ends of the radar
线性表——抽象数据类型
C language makes it easy to add, delete, modify and check the linked list "suggested collection"
rust统计文件中单词出现的次数
解决 contents have differences only in line separators