>Hi everybody,
>
>If I have a cursor to process which I'm scanning and based on this cursor I need to change (update & insert) several tables (one record per each) is it better (performnce wise) to use
>
>UPDATE where PK = cursor.Field
>
>vs.
>
>if seek(PKField, 'MyTable')
> replace in myTable
>endif
>
>Assuming all the tables are in buffered 5 mode.
>
>Thanks a lot in advance.
SEEK beats WHERE because SEEK uses
http://en.wikipedia.org/wiki/Binary_search and the WHERE clause uses Rushmore Technology.
SET TALK OFF
SET STATUS BAR OFF
USE c:\speed\speed
a=SECONDS()
FOR x = 1 TO 1000
UPDATE SPEED SET SPD_ID = 5352770 WHERE SPD_ID = 5352770
ENDFOR x
?SECONDS()-m.a
Takes 14.687 on my C: drive
SET ORDER TO TAG IXSPDID
a=SECONDS()
FOR x = 1 TO 1000
SEEK 5352770
REPLACE SPD_ID WITH 5352770
ENDFOR x
?SECONDS()-m.a
Takes 0.250 seconds.