mysql> select count(id) from post; +-----------+ | count(id) | +-----------+ | 18836 | +-----------+ 1 row in set (1.06 sec) 我的怎么慢得要死 innodb数据库 服务器配置 P4 3.0 1G 服务器基本上没有什么访问量 是innodb的问题 在select 前先运行 set autocommit=0 再select count() from t 速度是慢 转换成myisam速度马上提上去了 mysql> select count(*) f +----------+ | count(*) | +----------+ | 18836 | +-...
为什么 select count(fieldName) 比select count(*)慢很多? 根据set explain on看cost 发现select count(*)比select count(fieldName)要快很多,不知道是什么原因?请高手指教。
命令格式:SQL> select count(*) from table name where field name like "XX"; 结果没有任何信息返回,请看附件。 为什么?
以下是我的select 语句: select count(*) from (select a.dw as dw,a.gr as gr,b.zt as zt,nvl((select sum(sr) from tablea),0)-nvl((select sum(zc) from tablea),0) as amt from a,b where a.list=b.list) where dw='1' and amt>0 上面的语句计算出的结果为10000 然后把select count(*) 改为select *其他条件都不变,结果出来的记录条数是8500。 经查当select count(*) 的时候,好像是amt>0这个条件没有起作用。 不知道什么...
[quote] 1> select 2> count (*) 3> from exchg where inbank like '1024210 4> 00018%' and (recverserial between 0 and 99999999) 5> and dcflag like '2%' and printflag like '1%' order by recverserial 6> go ----------- 0 0 (2 rows affected) [/quote]为什么是这样的?不是只有一个结果的吗?
select count(*) from (select distinct field1 from TAB1) 上面的查询中TAB1.field1建有索引,因此理论上数据库应该检索索引,提高效率。 但是在informix 中无论怎样调整,都是SEQUENTIAL SCAN 实际运行时,TAB1有1000万条记录,在Informix中需要3分钟运行,还是unix服务器。 但是在Oracle数据库,自己的ibm笔记本电脑,不用特别优化,同样的数据,只需要7秒。 这个差别也太大了,可以说是为什么informix没落的原因,至少我是不...
select count(*) from tablea"); /* 使用 OCIDefineByName 要在执行 OCIExecute 前 */ OCIDefineByName($stmt,"EMPNO",&$count(*) ); OCIExecute($stmt); while (OCIFetch($stmt)) { echo "$EMPNO"; } OCIFreeStatement($stmt); OC...