下面两条sql语句
,我测试了一下,怎么上面一条查询还要比下面的查询速度更快一些呢?上面的语句明明多了一个keywords条件啊? if($g_keywords)
{
$result_content = $db->query_once("select id,title,content from content,content_1 where id=fid and p_already=0 and k_already=1 and keywords='{$keywords}'");
}
else
{
$result_content = $db->query_once("select id,title,content from content,content_1 where id=fid and p_already=0 and k_already=1");
}
,我测试了一下,怎么上面一条查询还要比下面的查询速度更快一些呢?上面的语句明明多了一个keywords条件啊? if($g_keywords)
{
$result_content = $db->query_once("select id,title,content from content,content_1 where id=fid and p_already=0 and k_already=1 and keywords='{$keywords}'");
}
else
{
$result_content = $db->query_once("select id,title,content from content,content_1 where id=fid and p_already=0 and k_already=1");
}
解决方案 »
- 有没有一种工具,可以把表跟表之间的关系用图形表示出来呢
- union出来的表可以删除记录么
- MySql
- mysql安装问题
- 我导入的数据库文件有些表有中文内容怎么用Navicat for MySQL打开是乱码
- mysql自动关闭
- 小生愚笨,1个小时了还不知道这个SQL怎么写
- 局域网内mysql远程连接mysql数据库服务器不让,什么原因啊?
- 急求数据库高手帮助!解决难题:Access数据库转换为Mysql+ASE的数据库。
- ERROR 1045 (28000): Access denied for user'root'@'localhost'(using password:YES)
- 求sql语句(mysql)
- mysql 插入值问题,很吐血
from content,content_1
where id=fid
and p_already=0
and k_already=1
and keywords='{$keywords}';
explain select id,title,content
from content,content_1
where id=fid
and p_already=0
and k_already=1;用上面语句EXPLAIN一下,
然后
show index from content;
show index from content_1;估计你有一个基于 keywords 的索引,而这个索引的不重复记录很多
explain SQL语句
跟踪下看看就明白多了