NAV C/AL code vs NAV Query Object

jordi79
Member Posts: 280
Hi,
Version affected in NAV2017 cu 14.
Recently we hit a performance related issue. When I investigated further, I found out that this was caused by Query Objects in the Role Center. And when I tested, I even found out that it was better to use NAV C/AL to get the calculated results vs NAV Query object.
This is because, NAV Query object results are not cached. And the Role Center pages are updated every time user reverts to this page. So in a normal user usage, this page can be updated many times in 1 session. However, NAV C/AL results are cached. Therefore it is better to use NAV C/AL to retrieve results for Role Center pages and not queries.
You can read more in -->
https://docs.microsoft.com/en-us/dynamics-nav/query-objects-and-performance#differences-between-query-and-record-result-sets
My question is... in what circumstances would a NAV Query be better than using NAV c/al?
p/s Also, I would like to add that NAV standard role center uses NAV query objects.
Jordi
Version affected in NAV2017 cu 14.
Recently we hit a performance related issue. When I investigated further, I found out that this was caused by Query Objects in the Role Center. And when I tested, I even found out that it was better to use NAV C/AL to get the calculated results vs NAV Query object.
This is because, NAV Query object results are not cached. And the Role Center pages are updated every time user reverts to this page. So in a normal user usage, this page can be updated many times in 1 session. However, NAV C/AL results are cached. Therefore it is better to use NAV C/AL to retrieve results for Role Center pages and not queries.
You can read more in -->
https://docs.microsoft.com/en-us/dynamics-nav/query-objects-and-performance#differences-between-query-and-record-result-sets
My question is... in what circumstances would a NAV Query be better than using NAV c/al?
p/s Also, I would like to add that NAV standard role center uses NAV query objects.
Jordi
0
Answers
-
microsoft dynamics nav and microsoft dynamics 365 business central. Is both have the same query?-1
-
Yes. Both Dynamics NAV and 365 BC have the same Query Object. They are both of similar product line, and having the same code base. Just different branding and version. Just like Microsoft Office Products.0
-
And to answer your question about what is better in what circumstances.
The best answer is : it depends.
But a guideline could be, that if you have multiple tables to connect (like header-sales) and a limited amount of fields, it probably is better to use a query.
Another advantage for a query is that, if needed, you might be able to create a covering index for it. That is an index (or a key in NAV) that contains all fields used in the query so that SQL doesn't not need to get to the table itself to get other fields. This can speed up a query a lot. Of course, it has a cost: the index needs to be updated so writing to the table becomes a little slower. Again: is it better or not? And again: it depends.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I would replace a nested loop with a single call to NAV/BC query, but I will never embed a NAV/BC query inside a loop. Due to the caching issue it will perform badly.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions