数据库
首页 > 数据库> > SQL 快速获取行数量的方法

SQL 快速获取行数量的方法

作者:互联网

SQL 快速获取行数量的方法

方法1:

select count(*) from table1

缺点:随着数据量大,会越来越慢

方法2:

select count(id) from table1

只搜索其中一个字段,会快很多,或者这样写:

select count(1) from table1

方法3:

select rows from sysindexes where id = object_id('表名') and indid < 2

  

  

 

 

创建时间:2021.12.31  更新时间:

标签:count,table1,索引,indid,获取,SQL,快速,id,select
来源: https://www.cnblogs.com/guorongtao/p/15751594.html