Board index » off-topic » Table1.recordcount

Table1.recordcount


2006-01-20 08:58:10 PM
off-topic0
We are using Table1.recordcount to determine the number of records in a dBase Table. large files take longer to execute the first time the recordcount is executed. In file size>a million records it can take over 10 seconds.
Is there a faster way to get the total records of large dBase files? We are using D6 & IP3000.
Thanks,
John Donaldson
 
 

Re:Table1.recordcount

John Donaldson wrote:
Quote
Is there a faster way to get the total records of large dBase files?
We are using D6 & IP3000.
Not really. Most databases must read all of the records and count them
to get the count. The one exception that I know of is Paradox tables
which store the record count in the table header. The best solution is
to not use the record count.
--
Bill Todd (TeamB)
 

Re:Table1.recordcount

Execute the query:
with TQuery.Create(nil) do
try
SQL.Text := 'SELECT COUNT(*) FROM ' + yourTableName;
DatabaseName := yourTTable.DatabaseName;
Alias := yourTTable.Alias;
Open;
yourRecordCount := Fields[0].AsInteger
finally
Free
end;
PS: to get the record count in TTable, the dataset must fetch (load) all
records to client cache and for large tables it takes a time.
"John Donaldson" < XXXX@XXXXX.COM >wrote in message
Quote

We are using Table1.recordcount to determine the number of records in a
dBase Table. large files take longer to execute the first time the
recordcount is executed. In file size>a million records it can take over
10 seconds.
Quote
Is there a faster way to get the total records of large dBase files? We
are using D6 & IP3000.
Thanks,
John Donaldson
 

{smallsort}

Re:Table1.recordcount

Mike,
Tried this approach and compared to Ttable which is exactly the same amount of time. The bde must be using sql...
Thanks,
John
"Mike Shkolnik" < XXXX@XXXXX.COM >wrote:
Quote
Execute the query:

with TQuery.Create(nil) do
try
SQL.Text := 'SELECT COUNT(*) FROM ' + yourTableName;
DatabaseName := yourTTable.DatabaseName;
Alias := yourTTable.Alias;
Open;
yourRecordCount := Fields[0].AsInteger
finally
Free
end;

PS: to get the record count in TTable, the dataset must fetch (load) all
records to client cache and for large tables it takes a time.

--
With best regards, Mike Shkolnik
EMail: XXXX@XXXXX.COM
www.scalabium.com

"John Donaldson" < XXXX@XXXXX.COM >wrote in message
news:43d0ec72$ XXXX@XXXXX.COM ...
>
>We are using Table1.recordcount to determine the number of records in a
dBase Table. large files take longer to execute the first time the
recordcount is executed. In file size>a million records it can take over
10 seconds.
>Is there a faster way to get the total records of large dBase files? We
are using D6 & IP3000.
>Thanks,
>John Donaldson


 

Re:Table1.recordcount

"John Donaldson" < XXXX@XXXXX.COM >wrote in message
Quote

We are using Table1.recordcount ... In file size>a million records
it can take over 10 seconds. Is there a faster way ..
DBase can have deleted records throughout the table, so w/o
other information each record must be scanned for these flags.
Is there any way that you can keep your own separate record
count?
--JohnH
 

Re:Table1.recordcount

Quote
>"John Donaldson" < XXXX@XXXXX.COM >wrote in message
>news:43d0ec72$ XXXX@XXXXX.COM ...
>>
>>We are using Table1.recordcount to determine the number of records in a
>dBase Table. large files take longer to execute the first time the
>recordcount is executed. In file size>a million records it can take
over
>10 seconds.
>>Is there a faster way to get the total records of large dBase files?
We
>are using D6 & IP3000.
>>Thanks,
>>John Donaldson
if you want an aproximatelly count, you can divide the filesize by
recordsize
 

Re:Table1.recordcount

"John Herbster" <herb-sci1_at_sbcglobal.net>ha scritto nel messaggio
Quote

"John Donaldson" < XXXX@XXXXX.COM >wrote in message
news:43d0ec72$ XXXX@XXXXX.COM ...
>
>We are using Table1.recordcount ... In file size>a million records
it can take over 10 seconds. Is there a faster way ..

DBase can have deleted records throughout the table, so w/o
other information each record must be scanned for these flags.
Is there any way that you can keep your own separate record
count?

--JohnH
i think no.
i think that if you use a for or a while for count, you can test the flags.
daniele
 

Re:Table1.recordcount

John,
If you are using Dbase or Paradox (maybe Foxpro), you can use the
following procedure. It is not 100% accurate, but if you just need an
approximate count, it is OK. DbiGetExactRecordCount loops through all the
records. DbiGetRecordCount just takes the count from the table header, but
if the deleted records are not purged (via a pack), they will still be
included in the count.
Mike Thrapp
{======================================================================}
Function GetRecordCount(Table : TTable) : LongInt;
begin
try
DbiGetRecordCount(Table.Handle, Result);
except
DbiGetExactRecordCount(Table.Handle, Result);
end;
end; {GetRecordCount}
"John Donaldson" < XXXX@XXXXX.COM >wrote in message
Quote

We are using Table1.recordcount to determine the number of records in a
dBase Table. large files take longer to execute the first time the
recordcount is executed. In file size>a million records it can take over
10 seconds.
Is there a faster way to get the total records of large dBase files? We
are using D6 & IP3000.
Thanks,
John Donaldson
 

Re:Table1.recordcount

Mike Thrapp wrote:
Quote
but if the deleted records are not purged (via a pack), they will
still be included in the count.
That is not true for Paradox tables since a record delete permanently
deletes the record.
--
Bill Todd (TeamB)