当前位置:网站首页>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';
边栏推荐
- rust统计文件中单词出现的次数
- About statistical power
- sample_rate(采样率),sample(采样),duration(时长)是什么关系
- ROS安装报错 sudo: rosdep:找不到命令
- sample_rate(采樣率),sample(采樣),duration(時長)是什麼關系
- 视频自监督学习综述
- Lombok @builder annotation
- How to write good code defensive programming
- Find in MySQL_ in_ Detailed explanation of set() function usage
- LeetCode 6109. Number of people who know the secret
猜你喜欢
2022最新中高级Android面试题目,【原理+实战+视频+源码】
深入底层C源码讲透Redis核心设计原理
《ClickHouse原理解析与应用实践》读书笔记(5)
2022年阿里Android高级面试题分享,2022阿里手淘Android面试题目
一朵云开启智慧交通新未来
About Estimation with Cross-Validation
LeetCode 6111. 螺旋矩阵 IV
2022 latest intermediate and advanced Android interview questions, [principle + practice + Video + source code]
如何获取飞机穿过雷达两端的坐标
2022 Alibaba Android advanced interview questions sharing, 2022 Alibaba hand Taobao Android interview questions
随机推荐
Find in MySQL_ in_ Detailed explanation of set() function usage
Introduction to the development function of Hanlin Youshang system of Hansheng Youpin app
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
Is it safe for golden sun to open an account? Can I open an account free of 5 in case?
The 2022 China Xinchuang Ecological Market Research and model selection evaluation report released that Huayun data was selected as the mainstream manufacturer of Xinchuang IT infrastructure!
MySQL优化六个点的总结
Sibling components carry out value transfer (there is a sequence displayed)
The main thread anr exception is caused by too many binder development threads
How to choose the most formal and safe external futures platform?
Clickhouse (03) how to install and deploy Clickhouse
sample_rate(采樣率),sample(采樣),duration(時長)是什麼關系
LeetCode 6111. 螺旋矩阵 IV
English sentence pattern reference
蚂蚁集团开源可信隐私计算框架「隐语」:开放、通用
vs2017 qt的各种坑
c期末复习
7-1 链表也简单fina
Deep copy and shallow copy [interview question 3]
The 10th global Cloud Computing Conference | Huayun data won the "special contribution award for the 10th anniversary of 2013-2022"
技术分享 | 常见接口协议解析