Skip to content

Instantly share code, notes, and snippets.

@ignas-sakalauskas
Created April 17, 2017 18:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ignas-sakalauskas/fe19c27de9a4c7f9f6b8df0df5f9b6e9 to your computer and use it in GitHub Desktop.
SQL Quick Row Count
SELECT so.name as TableName, ddps.row_count as [RowCount]
FROM sys.objects so
JOIN sys.indexes si ON si.OBJECT_ID = so.OBJECT_ID
JOIN sys.dm_db_partition_stats AS ddps ON si.OBJECT_ID = ddps.OBJECT_ID AND si.index_id = ddps.index_id
WHERE si.index_id < 2 AND so.is_ms_shipped = 0
ORDER BY ddps.row_count DESC
-- https://ignas.me/tech/sql-quick-row-count/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment