- 论坛徽章:
- 0
|
回复 mmxcq
select a.id,b.id from a,b where a.id
taluyi 发表于 2010-03-08 17:22
mysql> select count(*) from p1,p1gl where p1.id <1000000 and p1.id=p1gl.pid a
nd p1gl.tid in(1,3,4);
+----------+
| count(*) |
+----------+
| 300044 |
+----------+
1 row in set (1.33 sec)
mysql> select count(*) from p1,p1gl where 1000000 <p1.id <2000000 and p1.id
=p1gl.pid and p1gl.tid in(1,3,4);
+----------+
| count(*) |
+----------+
| 3350340 |
+----------+
1 row in set (27.61 sec)
mysql> select count(*) from p1,p1gl where p1.id>1000000 and p1.id=p1gl.pi
d and p1gl.tid in(1,3,4);
+----------+
| count(*) |
+----------+
| 3050295 |
+----------+
1 row in set (13.33 sec)
mysql>
查询分开了查 然后合并结果集 也差不多哦 好像总体时间还慢些 |
|