Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed problems - getting desperate
Message
From
01/03/1999 15:21:45
 
 
To
01/03/1999 15:13:01
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00192832
Message ID:
00192840
Views:
22
>>>In order to load my forms as quickly as possible, I am trying to use views instead of the actual tables. But the views don't seem to be loading quickly!
>>>
>>>I've marked all of my views as NoDataOnLoad in the DataEnvironment but they still take a long time to open. Why would the statement USE MyView NODATA take a long time to execute?
>>>
>>>Here is a sample view:
>>>
>>>SELECT Table1.LinkField,Table1.Field1,Table1.Field2, ;
>>> Table1.Field3, Table1.Field4, Table1.Field5 ;
>>>FROM Table1;
>>> INNER JOIN Table2 ;
>>> ON Table2.SeqNo=Table1.LinkField ;
>>> WHERE Table2.Id="123"
>>>
>>>According to the SYS(3054) function, everything is optimized. I have DELETED() tags on both files. I have tags on Table2.SeqNo and Table2.Id. Why should this SELECT seem to take forever? What can I do to speed it up? This is only one of several views I need to open and requery.
>>>
>>>Thanks!
>>>Elyse
>>
>>How many records you expect to get in the recordset? What is destination of this view? Grid?
>
>The base tables each have 372,000 records. The recordset of the view I was testing had about 45 records. In the form these records will end up in a grid, but I saw the problem with the speed just from the Command Window.

That's true- you will get the same speed from either Command window or application. The point is that grid will give your one opportunity to speed up the code. Basically there are three ways to improve speed in your case and all them are real:
1) If you really select just few records then separating SELECT-SQL to two will make it faster: on first step you apply filter only (Table2.Id="123") and next SELECT will join small recordset to another large table.
2) You may get even better speed if you replace select with SEEK/SKIP/INSERT loop.
3) You will get the ultimate, hopefully blazing speed if you shift join to grid itself, i.e. you will get small recordset from one table only and 'join' necessary fields from the second table using customized (SEEK()) grid.column.controlsources

So you have options what to use. Obviously, any of this ways will effectively reduce the opportunity to work with local views, and imply working with cursors.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform