Number of records in table

JvdB

Member
Hello Peggers,

Does anybody know a way to quickly see how many records there are in a table.

We tried:

for each {table-name}:
i = i + 1.
end.
display i.

and also tried :

select count(*) from {table-name}

But when you have a large db/table this can take a lot of time.

Is there a faster way to find out the number of records in a table?
Thnx already.

J
 

M-HT

Member
Hi J,
you can try this, but I don't know if it's faster (test yourself).

DEFINE QUERY qTemp FOR {table-name} FIELDS.
OPEN QUERY qTemp PRESELECT EACH {table-name} NO-LOCK.
iCount = NUM-RESULTS("qTemp").
CLOSE QUERY qTemp.
DISPLAY iCount.
 

JvdB

Member
Thnx Justin,

It is sure faster, but is there also a way to do it for only one table? Somehow this is not mentioned in the helpfile and yet the name tabanalys would make me expect it should be possible to use it for one table and not an entire database....(i also noticed there is a dbanalys)

Thnx already.

J.
 
Top