SQL Server快速查询某张表的当前行数
传统做法可能是select count(1)
但是往往会比较慢。推荐如下做法:
SELECT ISNULL(MAX(rowcnt), 0) CurrentRowCount
FROM sys.sysindexes
WHERE id = OBJECT_ID('TableName')
2023-07-23 10:31:04
传统做法可能是select count(1)
但是往往会比较慢。推荐如下做法:
SELECT ISNULL(MAX(rowcnt), 0) CurrentRowCount
FROM sys.sysindexes
WHERE id = OBJECT_ID('TableName')