August 25, 2003 at 12:17 pm
Hi everyone. I have a dilema. Enterprise Mananger and Query Analyzer show different counts on one of my tables. QA is showing the right count. What is going on? Thanks in advance.
August 25, 2003 at 1:40 pm
How are you doing the counts in EM? If you are just looking at properties of the table, then you can possibly get a wrong count in EM. I am not sure why, but it might be related to statistics needing to be updated for the table.
August 25, 2003 at 1:51 pm
Agree will also update statistics.
Plan B run a DBCC UPDATEUSAGE.
Can you post the QA code
August 25, 2003 at 1:55 pm
I look at the counts in EM through the table properties. In QA, I run a simple "select count(1)" statement.
I have already ran a "Update statistics" statement. But it didn't help. Just ran DBCC UPDATEUSAGE, and it didn't help either.
Does anyone know where EM gets the count from?
August 25, 2003 at 2:29 pm
Did you run
DBCC UPDATEUSAGE (DB_NAME(),'TableName') WITH COUNT_ROWS
EM is getting it from SysIndexes.
-- sp_MStablespace
SELECT @rows = convert(int, rowcnt)
FROM dbo.sysindexes
WHERE indid < 2 and id = @id
How many records in the table
Maybe try a DBCC Checktable.
August 25, 2003 at 4:28 pm
TableName->OpenTable->Return All Rows; does it bring the same count as QA?
After all your update statistics, can you do a table->refresh from EM, and check ?just curious...
August 25, 2003 at 5:27 pm
quote:
How are you doing the counts in EM? If you are just looking at properties of the table, then you can possibly get a wrong count in EM. I am not sure why, but it might be related to statistics needing to be updated for the table.
-- exactly
August 25, 2003 at 5:33 pm
No flames please but you are on the same box same database
Did happens once, many moons ago many servers and many dbs after lots of coffee, etc.
August 26, 2003 at 11:54 am
This did the trick:
DBCC UPDATEUSAGE (DB_NAME(),'TableName') WITH COUNT_ROWS
Thanks for your input everyone!!
September 10, 2003 at 9:37 am
I've come across the same thing .... now I only use the count from EM properties as an approximation. I use select count(*) from either QM or EM if I need the "real" # of rows. Why doesn't EM update the statistics dynamically ?? Running update statistics is cumbersome and impractical.
September 11, 2003 at 1:19 pm
It is a terrible "bug" in my opinion. A lot of my tables had very different counts than those that EM showed. Some tables had thousands more rows of data than EM showed. I have set up a job to correct the numbers every morning, that should help a little.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply