Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locate record(s) - fastest way
Message
From
05/02/2002 06:57:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00615261
Message ID:
00615332
Views:
14
>Hi,
>
>I'm trying to make a searchform where Ithe user can serach for a customer on muliple fields at the same time (fields are phonenumber, name, adresse, zipcode...)
>
>If I make a select statement with all these fields in it - the query takes up to 30 seconds og at table with 350000 records. How can I optimize this searchtime ?
>
>
>Regards,
>
>Kenneth Ingebrigtsen

Kenneth,
Your search fields sound to be no more than a few where one of the records wouldn't no longer than one K. You might copy them to an SDF file and search on line numbers. ie:

select myTable
copy fields phonenumber, name, adresse, zipcode to mydata.txt type sdf
StrToFile(upper(FileToStr('mydata.txt'),'myData.txt')

*Search routine
lparameters tcSearch
set memowidth to 1024
lcSearch = FileToStr('myData.txt')
create cursor ExistIn (irec i)
nOccurs = occurs(upper(tcSearch),lcSearch)
for ix = 1 to nOccurs
insert into ExistIn values (atline(tcSearch,lcSearch))
endfor
select * from myTable ;
where recno() in ;
(select irec from ExistIn) ;
into cursor crsResult

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform