I'm trying to calculate how many pages a single table has. For this i end up with different queries
SELECT SUM(si.dpages)
FROM sys.sysindexes si
INNER JOIN sys.tables st on si.id = st.object_id
WHERE st.name = 'job'
SELECT SUM(page_count)
FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, NULL) s
WHERE
s.database_id = db_id()
and s.object_id = OBJECT_ID('job')
SELECT SUM(used_page_count)
FROM sys.dm_db_partition_stats
WHERE object_id = OBJECT_ID('job');
dbcc ind
(
'wellnew'
,'dbo.job'
,-1
);
And these are the results:
- 16681
- 16681
- 16771
- (16771 row(s) affected)
Now, which one is right? Or what's the correct way to get that information? There is quite a similar question here it's even using a query similar tom mine, but i have 4 queries that in theory are all correct but they return different results
Thanks in advance Henrry