What will result in the fastest execution
GET or FINDFIRST
ex1 :
setuptable.get();
or
setuptable.findfirst();
ex2 :
location.setrange(code,mycode);
location.findfirst;
or
location.get(mycode);
and what if i would like to modify the location record get?? findfirst?? findset(true,true);
think about it :-k
**********************
** SI ** Bert Van Gestel **
**********************
0
Comments
a FINDFIRST is a SELECT TOP 1 * FROM Table where Field = Value
and a GET is SELECT * FROM Table Where Key = Value
I'm not the one to say the one is better then the other, but with a get, you can only use the primary key ... thus the clustered key (In general). When using FINDFIRST, you're able to go over non-key fields, which means it could be your key is not "perfect" for your select statement ... .
It is a good question for sure where the answer depends on the select you're using... . In case it's both going over the primary keys... I don't know what's best. It seems the TOP 1 is less demanding ... but for this, I'm not sure.
PS: (Marks comment):
A GET will never do an ORDER BY (so it won't take a SETCURRENTKEY in account).
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
A FINDFIRST add's the TOP 1 and the ORDER BY.
That is the only difference.
(Now Waldo and I are going for lunch. )
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog