select * from table 效率很低
来源:互联网 发布:九本女王升级数据 编辑:程序博客网 时间:2024/04/29 09:42
select * from table 比 select * from table order by id 效率低。
mysql> EXPLAIN SELECT * FROM kn_site limit 1;
+----+-------------+---------+------+---------------+------+---------+------+-------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+------+---------------+------+---------+------+-------+-------+
| 1 | SIMPLE | kn_site | ALL | NULL | NULL | NULL | NULL | 91548 | NULL |
+----+-------------+---------+------+---------------+------+---------+------+-------+-------+
1 row in set (0.00 sec)
mysql> EXPLAIN SELECT * FROM kn_site ORDER BY id LIMIT 1;
+----+-------------+---------+-------+---------------+---------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+---------------+---------+---------+------+------+-------+
| 1 | SIMPLE | kn_site | index | NULL | PRIMARY | 4 | NULL | 1 | NULL |
+----+-------------+---------+-------+---------------+---------+---------+------+------+-------+
1 row in set (0.00 sec)
虽说达到的效果一样,但是还是要把索引字段体现到sql语句里面的。
- select * from table 效率很低
- Select * from (select * from Table)
- select 1 from table
- select 1 from table
- select 1 from table
- select 1 from table
- select 1 from table
- 请教Table()使用方法 select * from table(....)
- SqlServer对select * from (select *from table)支持
- Oracle select * from table 存储过程
- MySql create table ... as select * from ..
- 视图中慎用select * from table
- Select into from 与 Create Table As
- select * from table where 1=1
- select * from table where 1=1
- Select Column Name from a Table
- select * from table where 1=1
- select * from table where 1<>1
- php:获取校内图书借阅信息,并用飞信进行提醒
- VC在应用程序中播放声音文件
- ZOJ 3010 The Lamp Game
- Selenium的一个IE浏览器的启动异常
- visual studio2010Ultimal的秘钥
- select * from table 效率很低
- 在工具栏中添加组合框
- VIM: C程序员插件C.vim
- js跨域问题
- UIPanGestureRecognizer学习笔记
- 揭秘传智播客班级毕业薪资超7k的内幕系列之二----Offer薪资5.7k,就业老师凭什么不让就业
- What is ActiveX控件
- 1111
- 1111