MySQL索引查询(EXPLAIN UNION)

sql 复制代码
explain select * from city where ID>500 limit 10;

explain select `Name`,CountryCode,District from city where District='Utrecht';



explain select `Name`,CountryCode,District from city where ID=5;

explain select `Name`,CountryCode,District from city where ID<5;

explain select `Name`,CountryCode,District from city where CountryCode like 'NL_';

explain select `Name`,CountryCode,District from city where CountryCode='NLD' OR CountryCode='PHL';

explain select `Name`,CountryCode,District from city where CountryCode in('NLD','PHL');

explain select * from city where ID>500 limit 10;

explain select `Name`,CountryCode,District from city where District='Utrecht';

explain select `Name`,CountryCode,District from city where ID=5;

explain select `Name`,CountryCode,District from city where ID<5;

explain select `Name`,CountryCode,District from city where CountryCode like 'NL_';

explain select `Name`,CountryCode,District from city where CountryCode='NLD' OR CountryCode='PHL';

explain select `Name`,CountryCode,District from city where CountryCode in('NLD','PHL');

性能最快的方法是union联合查询

sql 复制代码
explain 
select `Name`,CountryCode,District from city where CountryCode='NLD'
union
select `Name`,CountryCode,District from city where CountryCode='PHL';
相关推荐
jllllyuz16 分钟前
如何为服务器生成TLS证书
运维·服务器·数据库
rit843249935 分钟前
ELK实现nginx、mysql、http的日志可视化实验
mysql·nginx·elk
面朝大海,春不暖,花不开1 小时前
使用 Python 正则表达式实现文本替换与电话号码规范化
python·mysql·正则表达式
伍六星1 小时前
Flask和Django,你怎么选?
数据库·django·flask
杜哥无敌1 小时前
ORACLE 修改端口号之后无法启动?
数据库·oracle
远方16091 小时前
0x-4-Oracle 23 ai-sqlcl 25.1.1 独立安装-配置和优化
数据库·ci/cd·oracle
远方16092 小时前
0x-3-Oracle 23 ai-sqlcl 25.1 集成安装-配置和优化
数据库·ide·ai·oracle
喵叔哟3 小时前
第1章:Neo4j简介与图数据库基础
数据库·oracle·neo4j
喵叔哟3 小时前
第6章:Neo4j数据导入与导出
数据库·oracle·neo4j
甜甜的资料库3 小时前
基于微信小程序的睡眠宝系统源码数据库文档
数据库·微信小程序·小程序