当前位置:网站首页>Understand the index of like in MySQL
Understand the index of like in MySQL
2022-06-22 20:24:00 【InfoQ】
Prepare the data
CREATE TABLE `user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

like % in front
select * from user where name like '% Zhang %';
select * from user where name like '% Zhang ';Why not index
select id, name from user where name like '% Zhang '; 
idnameWhy did you go to the index again
like % rearwards
like%select * from user where name like ' Zhang %';
select * from user where name like ' Zhou %'; 

like Zhang %like Zhou %%Why not index
%like Zhang idx_nameForce Index
select * from user force index(idx_name) where name like ' Zhang %';
The latter
边栏推荐
- Containerd容器运行时(2):yum安装与二进制安装,哪个更适合你?
- MySQL Basics - functions
- 【深入理解TcaplusDB技术】TcaplusDB运维
- Using span method to realize row merging of multi-layer table data
- EasyDSS问题及解决方案汇总
- web技术分享| 【高德地图】实现自定义的轨迹回放
- [deeply understand tcapulusdb technology] tcapulusdb table management - modify table
- 【已解决】--go_out: protoc-gen-go: Plugin failed with status code 1.
- Traversal of trees and forests
- Summary of 2019: 31 is just another start
猜你喜欢
![[deeply understand tcapulusdb technology] view the online operation of tcapulusdb](/img/6f/2d62030e631e3085acf72951f2416f.png)
[deeply understand tcapulusdb technology] view the online operation of tcapulusdb

Possible security vulnerabilities in NFT

请你描述下从浏览器上输入一个url到呈现出页面的整个过程。

MySQL基础——函数

3个月自学自动化测试,薪资从4.5K到15K,鬼知道我经历了什么?

Multi transactions in redis

Introduction of Neural Network (BP) in Intelligent Computing

ROS从入门到精通(八) 常用传感器与消息数据

【Proteus仿真】8x8Led点阵数字循环显示

Traversal of trees and forests
随机推荐
Nestjs 集成 config module 与 nacos 实现配置化统一
JWT简介
Search, insert and delete of binary sort tree
完全背包如何考慮排列問題
Metu stability and operation and maintenance guarantee scheme
【深入理解TcaplusDB技术】TcaplusDB 表管理——修改表
元宇宙中的云计算,提升你的数字体验
MySQL Basics - functions
Goldfish rhca memoirs: do447 managing user and team access -- creating and managing ansible tower users
An IPFs enabled email - skiff
怎样实现网页端im即时通讯中的@人功能
Dynamicdatabasesource, which supports the master-slave database on the application side
NFT 中可能存在的安全漏洞
[deeply understand tcapulusdb technology] realize tcapulusdb transaction management in the operation and maintenance platform
【深入理解TcaplusDB技术】入门Tcaplus-JDBC开发
采用QTest进行数据集测试-性能测试-GUI测试
【深入理解TcaplusDB技术】TcaplusDB 表管理——重建表
Random talk about redis source code 122
Cloud computing in the metauniverse to enhance your digital experience
[in depth understanding of tcapulusdb technology] introduction tcapulusdb problem summary