Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up search - Locate For or Seek?
Message
From
26/07/2000 14:26:54
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00397065
Message ID:
00397201
Views:
32
Hey George, I've tried to duplicate your results, but I cannot. With the tag set I'm getting 36 seconds and without it I get .29 seconds. This has always been my experience. There was even a time when it was recommended that you SET ORDER TO 0 before running an SQL, but that's not necessary anymore. Here's how I created my table and how I tested the performance ... I hope I got the UT code formating stuff right.


*Create a million record speed testing table
set talk off
set echo off
create database speed
open database speed shared
create table large (field1 c(10), field2 i, field3 t)
CLEAR ALL
SELECT 0
use speed!large EXCL
m.field3 = datetime()
for lnI = 1 to 1000000
field1 = alltrim(str(m.lnI))
field2 = m.lnI
insert into large from memvar
next i
SET COLLATE TO "MACHINE"
index on field1 tag field1
index on field2 tag field2
index on field3 tag field3
clear all


and here's my test code...


*Do a bunch of searches for speed tests
SET TALK OFF
SET ECHO OFF
USE SPEED!LARGE excl
set deleted off
SET COLLATE TO "MACHINE"
*!* local lnI
*!* set order to field1
*!* a=seconds()
*!* for lnI = 1 to 10000
*!* seek "500000 "
*!* endfor
*!* ?seconds()-a

set order to
a=seconds()
for lnI = 1 to 100
locate for field1 = "500000 "
endfor
?seconds()-a

set order to field1
a=seconds()
for lnI = 1 to 100
locate for field1 = "500000 "
endfor
?seconds()-a

set deleted on
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform