Hi,
It looks like there is big difference when you use FindFirst as compare to GET
FINDFIRST is much better than GET
I have tried on Setup tables like General Ledger Setup
SQL statements are generated like this.
FINDFIRST - Select TOP 1 ...... ORDER BY Primary_Key
GET - Select * ..... WHERE Primary_Key=
@P1
Also please advise when you have blob fields, does it cause issue as well
even picture fields are not in use except reports. SQL always excecute like this
SELECT *,DATALENGTH("Picture 1"),DATALENGTH("Picture 2"),DATALENGTH("Picture 3")
and I run my expensive sql query and there is a big difference in total_elapsed_time.
Any view on this??
Thanks
Ajay
Comments
What drives you to this conclusion? Not sure I would agree. Unless you have a case where the NAV primary key is not the SQL clustered index. Then maybe? But with setup tables, as you example, since they only have 1 record...
Are you sure that your table has good statistics?
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I will do my test again.
UK
I have pointed this out to Microsoft and they pretty much shrugged it off. IMHO, by design, a GET returns ONE record, so it should be a SELECT TOP 1.
It won't make a difference in your occasional InventorySetup.GET. But if you have a GET inside a loop that executed thousands or millions of times, the FINDFIRST will be better for overall SQL performance.
Dynamics-NAV.org
RIS Plus, LLC
It really doesn't sound illogical to me at all, although I'd have to test it on a larger scale. I've definitely had weird performance issues with GET queries on single record tables.
RIS Plus, LLC
Another of those "to be tested when I find some time" things.
2) Doing a InventorySetup.GET in a loop should be avoided by the C/AL programmer in the first place! Even it the data comes from the buffer, it takes unnecessary CPU-cycles to run the code.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!