Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to optimize existing code
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00610153
Message ID:
00611086
Views:
25
Sergey -
Are you sure EMPTY() is not optimizable? I don't know why it would not be, since it has a fairly unambiguous meaning.

Also, it might be faster to perform the SPACE(LEN(web_exp)) once and assign it to a variable, and then reference that variable in the SQL. I'm pretty sure that VFP will evaluate the WHERE clause for every record if it involves a field in the table.
zahid

>Hi Sunshine,
>
>In order to speed up your query you have to let VFP to use Rushmore. See http://msdn.microsoft.com/library/en-us/fox7help/html/dgUsing_Rushmore_to_Speed_Data_Access.asp for how it works. To make your select Rushmore optimazable you've to:
>- create index on 'web_exp' field in the 'student' table
>- Replace Empty() function in the query because it's not optimazable
>
select courseid, classid, studentid, birthdate, firstname, middlei, ;
>       lastname, address, city, state, zip ;
>  from student ;
>  where web_exp = SPACE( LEN(web_exp )) ;
>  into table c:\tempweb
>
Now it should be much faster.
>
>>I have the following code that takes forever to run. Can anyone suggest ways of speeding up the process?
>>
>>select courseid,classid,studentid,birthdate,firstname,middlei,lastname,address,city,state,zip;
>>from student;
>>where empty(web_exp);
>>into table c:\tempweb
>>
>>open database hunter
>>use vwhe_card
>>append from c:\tempweb
>>
>>*!* want to do this later just in case the above didn't work
>>select student
>>set filter to empty(web_exp)
>>replace web_exp with date() all
>>
>>I've also tried:
>>use student
>>set filter to empty(web_exp)
>>
>>open database hunter
>>use vwhe_card
>>append from student
>>
>>The database has over 390000 records. For test data, I'm looking for 42 records and it's taking so long. Should I set an index?
>>
>>I would appreciate any help and thanks in advance!
>>Sunshine
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform