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';
相关推荐
伤不起bb1 小时前
MySQL 高可用
linux·运维·数据库·mysql·安全·高可用
Yushan Bai7 小时前
ORACLE RAC环境REDO日志量突然增加的分析
数据库·oracle
躺着听Jay7 小时前
Oracle-相关笔记
数据库·笔记·oracle
瀚高PG实验室7 小时前
连接指定数据库时提示not currently accepting connections
运维·数据库
运维成长记8 小时前
mysql数据库-中间件MyCat
数据库·mysql·中间件
尘客.8 小时前
DataX从Mysql导数据到Hive分区表案例
数据库·hive·mysql
华纳云IDC服务商8 小时前
SQL Server权限设置的几种方法
mysql·sqlserver
TiDB 社区干货传送门9 小时前
从开发者角度看数据库架构进化史:JDBC - 中间件 - TiDB
数据库·oracle·中间件·tidb·数据库架构
虾球xz9 小时前
游戏引擎学习第280天:精简化的流式实体sim
数据库·c++·学习·游戏引擎
uwvwko10 小时前
BUUCTF——web刷题第一页题解
android·前端·数据库·php·web·ctf