Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Total of records after delete
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01438395
Message ID:
01438432
Views:
46
I would add an index on deleted too
CLEAR ALL
CLEAR
LOCAL lnSeconds, lnRecords, lnI

SET TALK OFF
SET ECHO OFF
CREATE CURSOR curTest (RecNum int, charfield C(30))
INDEX on DELETED() TAG DelRecs BINARY
RAND(-1)
FOR lnI = 1 TO 300000
  INSERT INTO curTest VALUES (m.lni, PADR(m.lnI,30,'0'))
  IF RAND() > 0.8
  	DELETE IN curTest
  ENDIF
NEXT

*DELETE FOR RecNum >200000

SET DELETED ON

SYS(1104)
lnSeconds = SECONDS()
SELECT COUNT(*) FROM curTest INTO ARRAY laTest
lnRecords = laTest[1]
RELEASE laTest

?'Select COUNT(*): ', SECONDS()-m.lnSeconds, lnRecords 

SYS(1104)
lnSeconds = SECONDS()
LOCAL lnSelect
lnSelect = SELECT()
SELECT curTest
COUNT TO lnRecords
SELECT (m.lnSelect)
RELEASE m.lnSelect
?'Change Area and COUNT: ',SECONDS()-m.lnSeconds, lnRecords

SYS(1104) 
lnSeconds = SECONDS()
SELECT 1 FROM curTest TO SCREEN noconsole
lnRecords = _tally
?'Select to screen: ', SECONDS()-m.lnSeconds, lnRecords  
CLOSE DATABASES all
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform