General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only