Question Gap Between dbanalys and COUNT

Hi guys.

On one of our table we did a dbanalys and he get us 39k record. But when we are executing a "COUNT" on the table, we are getting around 33k.

Do you have any why ? How is it possible?

Best Regards,

- Vivien -
 

TomBascom

Curmudgeon
Shockingly! You need to share your code to get a good answer!

Also - what version of Progress is involved? (Yes, it matters.)

Did you COUNT from embedded SQL-89, or via a 3rd party SQL tool (thus using SQL-92), or are you referring to the 4gl COUNT-OF function?

Did you try cross checking that result with a simple 4gl FOR EACH?

What specific value within dbanalys are you referring to? Record counts can be found in several places.

There are various reasons why the counts might not match. Some of them are due to bugs such as "duplicate unique rows". Or operational errors like loading data twice with "proutil load". Those can be fixed with an index rebuild.

Or you might have one or more of the SQL auto-truncate options enabled (that would apply if you are counting with SQL-92).

Other reasons are due to misunderstandings regarding how the counting methods work.
 
So @TomBascom

We are runinng OE10.2B08.

We are running test to update our ERP at first and after upgrade OE version.

Hi did run this method :
Code:
SELECT COUNT(*) FROM TABPOL
and this :

Code:
DEFINE VARIABLE k AS INTEGER NO-UNDO.

FOR EACH TABPOL NO-LOCK:
    k = k + 1.
END.

DISP k .

All this code was run from progress AppBuilder .

The dbanalys was run with PROENV. We where checking the "records" column
 

TomBascom

Curmudgeon
Did SELECT * give the same answer as FOR EACH?

There are several places where a “records” column appears in dbanalys.

Since this is a test - I suggest that you rebuild indexes for that table and re-run the dbanalys.
 
The SELECT * and the FOR EACH give exactly the same result.

Ok we will do that and i will keep you updated.

Thank you :)
 

Cringer

ProgressTalk.com Moderator
Staff member
Keep track of any errors the index rebuild returns. It's possible, as Tom says, you have data in your table that's not in the index you used on the FOR EACH. The most likely cause is that you have duplicate data in the table that can't be indexed because of uniqueness constraints of the index.
 
Top