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';
相关推荐
兜有米啦8 分钟前
数据库第二次作业
数据库
nVisual44 分钟前
机柜PDU安装位置与空间建模方案
大数据·网络·数据库·信息可视化·数据中心基础设施管理
weixin_66844 分钟前
Cursor-superpowers插件用法
数据库·人工智能
NWU_白杨1 小时前
三种常用的数据存储技术
数据库·redis·mysql·sqlite
吃饱了得干活1 小时前
亿级订单表分库分表设计,从0到1全流程
java·数据库·面试
蓝创工坊Blue Foundry1 小时前
图片文字提取到 Excel:批量任务如何先定义要交付的字段
运维·服务器·开发语言·数据库·自动化·ocr·excel
一嘴一个橘子1 小时前
MySqL 的 B+树、 叶子节点、非叶子节点
mysql
麦聪聊数据2 小时前
企业数据市场建设(三):API 化服务封装,让数据开箱即用、避免重复开发
数据库
脱胎换骨-军哥2 小时前
C++数据库存储引擎内核开发:B+树索引与MVCC并发控制的完整实现
数据库·c++·b树
麦聪聊数据2 小时前
企业数据市场建设(四):流程闭环与价值运营,让数据市场真正转起来
运维·数据库