Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select statement takes 10x longer in app vs. vfp
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
SAMBA Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01137819
Message ID:
01138029
Views:
10
OK, i've noticed and tried a couple of things here.

1. I noticed that when I ran the main program from within vfp8.0, it was still taking about 10x longer to run the query than simply running the query from the command window. Therefore, i realized that it has to be something from within my program causing the problem.

2. When I place, in the main program, a statement to "use" the view in 0 (the view created with the SQL statement), i noticed that I don't have to open up the tables that are being used by the view to have them available for other forms. now, when i run the program from within vfp8.0, the speed of running the query is great (about the same as running the query from the command window). unfortunately, this speed increase has not been realized within my application outside of the VFP8.0 window. Therefore, i'm posting my main program as well as the SQL from the view designer for the query in question.

3. Here is my main program right now:

set exclusive off
set safety off
SET OPTIMIZE ON
SET DELETED OFF
zoom window screen max
close all

OPEN DATABASE d_tasks
USE view_tasklist IN 0
USE view_memolist IN 0

use \\linux\project\patient alias patient in 0 &&a table from another database that &&needs to be opened

do menu1.mpr
read events

4. The actual SQL statement from "view_memolist" (the query that takes 10x longer to run in my program than in vfp8.0) is:

SELECT T_memo.pt_number, T_memo.memo_date, T_memo.memo_id,;
Memo_type.type, T_memo.memo, T_memo.type_number;
FROM ;
t_memo,;
memo_type;
WHERE T_memo.type_number = Memo_type.type_number

DBSetProp(ThisView,"View","SendUpdates",.T.)
DBSetProp(ThisView,"View","BatchUpdateCount",1)
DBSetProp(ThisView,"View","CompareMemo",.T.)
DBSetProp(ThisView,"View","FetchAsNeeded",.F.)
DBSetProp(ThisView,"View","FetchMemo",.T.)
DBSetProp(ThisView,"View","FetchSize",100)
DBSetProp(ThisView,"View","MaxRecords",-1)
DBSetProp(ThisView,"View","Prepared",.F.)
DBSetProp(ThisView,"View","UpdateType",1)
DBSetProp(ThisView,"View","UseMemoSize",255)
DBSetProp(ThisView,"View","Tables","d_tasks!t_memo")
DBSetProp(ThisView,"View","WhereType",3)

DBSetProp(ThisView+".pt_number","Field","DataType","N(4)")
DBSetProp(ThisView+".pt_number","Field","UpdateName","d_tasks!t_memo.pt_number")
DBSetProp(ThisView+".pt_number","Field","KeyField",.F.)
DBSetProp(ThisView+".pt_number","Field","Updatable",.T.)

DBSetProp(ThisView+".memo_date","Field","DataType","D")
DBSetProp(ThisView+".memo_date","Field","UpdateName","d_tasks!t_memo.memo_date")
DBSetProp(ThisView+".memo_date","Field","KeyField",.F.)
DBSetProp(ThisView+".memo_date","Field","Updatable",.T.)

DBSetProp(ThisView+".memo_id","Field","DataType","I")
DBSetProp(ThisView+".memo_id","Field","UpdateName","d_tasks!t_memo.memo_id")
DBSetProp(ThisView+".memo_id","Field","KeyField",.T.)
DBSetProp(ThisView+".memo_id","Field","Updatable",.F.)

DBSetProp(ThisView+".type","Field","DataType","C(75)")
DBSetProp(ThisView+".type","Field","UpdateName","d_tasks!memo_type.type")
DBSetProp(ThisView+".type","Field","KeyField",.F.)
DBSetProp(ThisView+".type","Field","Updatable",.F.)

DBSetProp(ThisView+".memo","Field","DataType","M")
DBSetProp(ThisView+".memo","Field","UpdateName","d_tasks!t_memo.memo")
DBSetProp(ThisView+".memo","Field","KeyField",.F.)
DBSetProp(ThisView+".memo","Field","Updatable",.T.)

DBSetProp(ThisView+".type_number","Field","DataType","N(3)")
DBSetProp(ThisView+".type_number","Field","UpdateName","d_tasks!t_memo.type_number")
DBSetProp(ThisView+".type_number","Field","KeyField",.F.)
DBSetProp(ThisView+".type_number","Field","Updatable",.T.)

5. Sorry for the long post here but thought that this information might be relevant. The problem, again, is that the program running in vfp8.0 window runs the above query about 10x faster than when it is run in the application.

Thanks,

Paul
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform