1.
select count(*) from tt
select count(id) from tt
哪个更快呢?我怀疑,是不是第一种快些,因为第二种它还要去找哪些id字段是空的,而不算入其内?
2.drop table test
create table test
(
id int identity(1,1),
name varchar(20)
)
如果现在表中有120000条数据
select top 1 * from test order by id desc
select max(id) from test
这两句话哪个会快些呢?max是不是会一个一个将表中的每一个id去比哪个大?
而第一种方法是倒序直接取第一条值会很快?