March 11, 2006 at 9:52 am
Could someone please explain why my count(*) does not match sysindexes.rows?
select rows, rowcnt
from sysindexes
where id = 100195407
rows rowcnt
----------- --------------------
365 365
select count(*), object_id(N'[dbo].[censusdataundergradexp]')
from dbo.censusdataundergradexp
----------- -----------
366 100195407
Thanks in advance.
March 11, 2006 at 4:35 pm
Because sysindexes.rows,rowcnt does not contain real-time data.
I presume it is updated with the statistics.
March 13, 2006 at 8:56 am
Thanks Jo.
I'll stick with select count(*) when I need to know the real time row count.
I tried "UPDATE STATISTICS censusdatageneric with FULLSCAN" and I tried simply updating one of the rows in the table, but sysindexes.rows wouldn't budge from its old count (which is several days old). We have "auto update statistics" turned on for the database.
March 13, 2006 at 9:21 am
try:
DBCC UPDATEUSAGE(0)
it will put them in synch
Cheers,
* Noel
March 13, 2006 at 10:47 am
Thanks Noel.
This worked just great:
DBCC UPDATEUSAGE(0) WITH COUNT_ROWS
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply