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';
相关推荐
u01092727137 分钟前
RESTful API设计最佳实践(Python版)
jvm·数据库·python
qq_192779877 小时前
高级爬虫技巧:处理JavaScript渲染(Selenium)
jvm·数据库·python
u0109272717 小时前
使用Plotly创建交互式图表
jvm·数据库·python
爱学习的阿磊7 小时前
Python GUI开发:Tkinter入门教程
jvm·数据库·python
tudficdew8 小时前
实战:用Python分析某电商销售数据
jvm·数据库·python
Fleshy数模8 小时前
CentOS7 安装配置 MySQL5.7 完整教程(本地虚拟机学习版)
linux·mysql·centos
sjjhd6528 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python
Configure-Handler8 小时前
buildroot System configuration
java·服务器·数据库
2301_821369619 小时前
用Python生成艺术:分形与算法绘图
jvm·数据库·python
az44yao9 小时前
mysql 创建事件 每天17点执行一个存储过程
mysql