当前位置:网站首页>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';
边栏推荐
- sample_ What is the relationship between rate, sample and duration
- Clickhouse (03) how to install and deploy Clickhouse
- 5. 数据访问 - EntityFramework集成
- Is it safe to open an account, register and dig money? Is there any risk? Is it reliable?
- What are the cache interfaces of nailing open platform applet API?
- LeetCode 6111. 螺旋矩阵 IV
- 《ClickHouse原理解析与应用实践》读书笔记(5)
- 7-1 linked list is also simple fina
- How to write good code defensive programming
- Powerful tool for collection processing
猜你喜欢
MySQL数据库索引教程(超详细)
websocket 工具的使用
Overview of video self supervised learning
Oracle 中文排序 Oracle 中文字段排序
深入底层C源码讲透Redis核心设计原理
基于can总线的A2L文件解析(3)
AI Open2022|基于异质信息网络的推荐系统综述:概念,方法,应用与资源
Use of websocket tool
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!
SAP feature description
随机推荐
常见时间复杂度
Various pits of vs2017 QT
进程间通信(IPC):共享内存
vulnhub之darkhole_2
鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!
2022 latest intermediate and advanced Android interview questions, [principle + practice + Video + source code]
Is it complicated to open an account? Is online account opening safe?
2022 Alibaba Android advanced interview questions sharing, 2022 Alibaba hand Taobao Android interview questions
RedHat7.4配置yum软件仓库(RHEL7.4)
Case sharing | integrated construction of data operation and maintenance in the financial industry
技术分享 | 接口测试价值与体系
AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务
ICML2022 | 长尾识别中分布外检测的部分和非对称对比学习
5. 数据访问 - EntityFramework集成
项目中遇到的问题 u-parse 组件渲染问题
Share: ZTE Yuanhang 30 Pro root unlock BL magick ZTE 7532n 8040n 9041n brush mask original brush package root method Download
Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)
Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
About statistical power
7-2 保持链表有序