Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan or Select, then scan
Message
 
To
28/01/2002 10:57:56
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00611587
Message ID:
00611782
Views:
16
I'm gonna go out on a limb and wager two cents that your first example

SELECT Table
SCAN FOR Ref = lcRef
lnRecNo = RECNO()
SCATTER MEMVAR
m.Ref = lcNewRef
INSERT INTO Table FROM MEMVAR
GO lnRecNo
ENDSCAN

might probably run slightly faster than the second example, especially if an index on ref exists and the order is set to the index tag containing that expression.

In your Example 2, Fox must still navigate through the records by performing a SQL - Select; however, it might also create either a filter on the original table or temp files; while this is not guaranteed to occur, the chance that it might occur esists and would take some miniscule amount of time LONGER that the first example would not require.

Better yet, comment out the storage and retrieval of the record number in your first example and don't scatter. Instead, try

SELECT ThisTable
SCAN FOR Ref = lcRef
INSERT INTO NewTable (Fld1, Fl12, Fld3) ;
VALUES (ThisTable.Fld1, lcNewRef, ThisTable.Fld3)
ENDSCAN

Not guaranteed to be any faster but who knows? It might eliminate the overhead of the added I/O cycles necessary to read the data into memory variables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform