- 浏览: 93004 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
xiaoyi829:
应该可以grzrt 写道分区表partition,能用hand ...
初识mysql插件之HandlerSocket -
grzrt:
分区表partition,能用handlersocket查询指 ...
初识mysql插件之HandlerSocket
select company_albums.id,company.name as company_name,company.url as company_url,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,qq ,brand_shop_id
from company,company_albums
where company_albums.com_id=company.id
ORDER BY `view_count` desc
LIMIT 69600, 15 ;
explain select company_albums.id,company.name as company_name,company.url as company_url,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,qq ,brand_shop_id
from company,company_albums
where company.id=company_albums.com_id
ORDER BY `view_count` desc
LIMIT 69600, 15 \G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: company_albums
type: ALL
possible_keys: com_idx
key: NULL
key_len: NULL
ref: NULL
rows: 72441
Extra: Using filesort
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: company
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: test_01.company_albums.com_id
rows: 1
Extra:
2 rows in set (0.00 sec)
----------------------------------------
select company_albums.id,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,company.name as company_name,company.url as company_url,qq ,brand_shop_id
from company_albums ,(select company_albums.id as ca_id
from company,company_albums
where company_albums.com_id=company.id
ORDER BY `view_count` desc
LIMIT 69600, 15) as t,company
where company.id=company_albums.com_id and t.ca_id = company_albums.id
order by view_count desc;
explain select company_albums.id,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,company.name as company_name,company.url as company_url,qq ,brand_shop_id
from company_albums ,(select company_albums.id as ca_id
from company,company_albums
where company_albums.com_id=company.id
ORDER BY `view_count` desc
LIMIT 69600, 15) as t,company
where company.id=company_albums.com_id and t.ca_id = company_albums.id
order by view_count desc\G;
*************************** 1. row ***************************
id: 1
select_type: PRIMARY
table: <derived2>
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 18
Extra: Using temporary; Using filesort
*************************** 2. row ***************************
id: 1
select_type: PRIMARY
table: company_albums
type: eq_ref
possible_keys: PRIMARY,com_idx
key: PRIMARY
key_len: 4
ref: t.ca_id
rows: 1
Extra:
*************************** 3. row ***************************
id: 1
select_type: PRIMARY
table: company
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: test_01.company_albums.com_id
rows: 1
Extra:
*************************** 4. row ***************************
id: 2
select_type: DERIVED
table: company_albums
type: ALL
possible_keys: com_idx
key: NULL
key_len: NULL
ref: NULL
rows: 72441
Extra: Using filesort
*************************** 5. row ***************************
id: 2
select_type: DERIVED
table: company
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: test_01.company_albums.com_id
rows: 1
Extra: Using index
5 rows in set (0.34 sec)
from company,company_albums
where company_albums.com_id=company.id
ORDER BY `view_count` desc
LIMIT 69600, 15 ;
explain select company_albums.id,company.name as company_name,company.url as company_url,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,qq ,brand_shop_id
from company,company_albums
where company.id=company_albums.com_id
ORDER BY `view_count` desc
LIMIT 69600, 15 \G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: company_albums
type: ALL
possible_keys: com_idx
key: NULL
key_len: NULL
ref: NULL
rows: 72441
Extra: Using filesort
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: company
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: test_01.company_albums.com_id
rows: 1
Extra:
2 rows in set (0.00 sec)
----------------------------------------
select company_albums.id,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,company.name as company_name,company.url as company_url,qq ,brand_shop_id
from company_albums ,(select company_albums.id as ca_id
from company,company_albums
where company_albums.com_id=company.id
ORDER BY `view_count` desc
LIMIT 69600, 15) as t,company
where company.id=company_albums.com_id and t.ca_id = company_albums.id
order by view_count desc;
explain select company_albums.id,company_albums.name as company_albums_name,company_albums.url as company_albums_url,view_count,thumbnail_path,company.name as company_name,company.url as company_url,qq ,brand_shop_id
from company_albums ,(select company_albums.id as ca_id
from company,company_albums
where company_albums.com_id=company.id
ORDER BY `view_count` desc
LIMIT 69600, 15) as t,company
where company.id=company_albums.com_id and t.ca_id = company_albums.id
order by view_count desc\G;
*************************** 1. row ***************************
id: 1
select_type: PRIMARY
table: <derived2>
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 18
Extra: Using temporary; Using filesort
*************************** 2. row ***************************
id: 1
select_type: PRIMARY
table: company_albums
type: eq_ref
possible_keys: PRIMARY,com_idx
key: PRIMARY
key_len: 4
ref: t.ca_id
rows: 1
Extra:
*************************** 3. row ***************************
id: 1
select_type: PRIMARY
table: company
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: test_01.company_albums.com_id
rows: 1
Extra:
*************************** 4. row ***************************
id: 2
select_type: DERIVED
table: company_albums
type: ALL
possible_keys: com_idx
key: NULL
key_len: NULL
ref: NULL
rows: 72441
Extra: Using filesort
*************************** 5. row ***************************
id: 2
select_type: DERIVED
table: company
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: test_01.company_albums.com_id
rows: 1
Extra: Using index
5 rows in set (0.34 sec)
发表评论
-
mysql dump 备份及脚本!
2011-06-10 13:38 1552导出多张表的时候表之间用空格分开: # mysqldump ... -
mysql备份脚本
2011-06-03 17:32 683!/bin/sh # mysql_backup.sh: bac ... -
CentOS挂载移动硬盘
2011-06-03 15:12 10971, 首先确认fuse,CentOS 5.5 带有fuse,可 ... -
MySQL 左连接 右连接
2011-06-03 14:03 868表A记录如下: aID aNum 1 ... -
[转]CentOS5 下安装与配置飞鸽传书(Ipmsg)完美完结篇
2011-05-27 10:29 1560CentOS5 下安装与配置飞鸽传书(Ipmsg)完美完结篇 ... -
深入SQL语句性能调整
2011-05-17 13:20 861本文sqlserver为例 有 ... -
windows和linux下开启mysql日志
2011-05-11 10:24 2322mysql有以下几种日志: 错误日志: -log-err 查询 ... -
MYSQL数据库设计的一点总结
2011-04-13 14:48 704选表类型: 大家都知道 ... -
mysql 清理碎片
2011-04-13 09:59 916显示你数据库中存在碎片的全部列表: select tab ... -
MySQL 建表语法
2011-04-12 14:21 7991、最简单的: CREATE TABLE t1( id ... -
MySQL性能优化
2011-04-02 10:53 732作者:andyao 原文link: http://andyao ... -
Mysql Innodb 引擎优化-参数
2011-03-30 16:49 769介绍: InnoDB给MySQL提供了具有提交,回滚和崩溃 ... -
MySQL前端和后台的系统优化
2011-03-30 16:39 798本文中介绍的系统优化 ... -
MySQL配置文件my.cnf 做笔记用
2011-03-30 16:33 801MySQL配置文件my.cnf 例子最详细翻译,可以保存做笔记 ... -
测试脚本mysql_插入100万行数据
2011-03-29 16:31 1359CREATE DEFINER=`root`@`localhos ... -
Mysql日期和时间函数
2011-03-29 15:50 675这里是一个使用日期函 ... -
MySQL数据库优化的具体方法说明
2011-03-29 15:39 760以下的文章主要讲述的是实现MySQL数据库简单实用优化的具体方 ... -
MySQL之Explain
2011-03-29 15:16 622前记:很多东西看似简 ... -
MySQL维护命令集锦--查看表的状态(show table status)
2011-03-29 15:11 1229查看表的引擎类型等状态信息: show table statu ... -
mysql show status参数详解
2011-03-29 15:03 970Aborted_clients 由于客户没有正确 ...
相关推荐
SQL在运行时先取出数个查询的结果,再用排序空间进行排序删除重复的记录,最后返回结果集,如果表数据量大的话可能会导致用磁盘进行排序。 实际大部分应用中是不会产生重复的记录,推荐采用UNION ALL操作符...
对查询结果进行排序后,取出第10条至第20条记录。 #### 26. 数据类型与优化 了解不同数据类型的存储方式和性能影响,合理选择可以提升查询效率和存储空间利用率。 #### 27. NULL值处理与枚举类型 设置字段不允许...
- **全索引扫描(Index Only Scan)**:仅通过索引获取所需数据,无需回表,效率更高,但要求索引包含所有查询字段。 - **位图扫描(Bitmap Index Scan)**:适用于多列组合索引或在大数据量下进行并集操作,通过...
例如,存储用户信息时,每个字段对应一个哈希键,比将整个对象序列化为字符串更灵活。然而,这会占用更多存储空间,需要权衡使用。 4. 集合(set) 集合类似 Java 中的 HashSet,成员唯一且无序。它可以用于存储不...
在MySQL中,查询倒数第二条记录通常涉及到对数据排序后进行限制选择。这里我们将讨论几种不同的实现方法,以及它们的适用场景和优缺点。 ### 方法1:使用`LIMIT`子句 ```sql SELECT * FROM holder_change_...
6. **按c字段排序取第21-30条记录**: ```sql SELECT * FROM ( SELECT T.*, ROWNUM RN FROM ( SELECT * FROM T ORDER BY c ) T WHERE ROWNUM ) WHERE RN >= 21; ``` ### 数据库基本概念类 1. **...
1.1 SQL Server服务器中,给定表table1中有两个字段ID、LastUpdateDate,ID表示更新的事务号,LastUpdateDate表示更新时的服务器时间,请使用一句SQL语句获得最后更新的事务号。 答:Select ID FROM table1 Where ...
1. 在数据库查询中,查找地址最后两个字为"8号"的记录,应该使用Right函数取出地址字段的最后两个字符进行比较。因此,正确答案是A. Right([地址],2)="8号"。 2. 在VB或类似编程环境中,要使文本框同时显示水平和...
- **使用索引不一定提高性能**:在全表扫描更快的情况下,索引可能无用。 - **绑定变量**:动态SQL中的占位符,减少硬解析,提高性能,但也可能导致执行计划不稳定。 - **稳定执行计划**:使用hints或绑定变量,...
静态编译后的易语言可执行程序(exe)和动态链接库(dll),运行时不再依赖任何支持库文件,文件尺寸更小(相对以前的独立编译),PE结构更合理(取消了“易格式体”),加载速度更快,而且有效解决了“病毒误报”和...
FormAuthenticationFilter拦截住取出request中的username和password(两个参数名称是可以配置的) FormAuthenticationFilter 调用realm传入一个token(username和password) realm认证时根据username...
- **报表向导**:通过向导引导用户完成报表创建的过程,相比自动报表提供了更多的自定义选项,如字段选择、排序规则等。 - **报表设计视图**:允许用户在设计视图中自由地设计报表的布局、样式等,具有高度的定制性...