SQL faster with this code?

Magno
Member Posts: 168
Hi,
I heared from someone that sql modify could work faster when you do this:
instead of :
is this true?
If it is, can someone give me some example to test this?
I heared from someone that sql modify could work faster when you do this:
rec.RESET; rec.SETFILTER(...); rec.find('-'); rec.field := value; rec.MODIFY();
instead of :
rec.RESET; rec.SETFILTER(...); rec.find('-'); rec2.COPY(rec); rec2.field := value; rec2.MODIFY();
is this true?
If it is, can someone give me some example to test this?
0
Comments
-
Well I wouldn't think so, because you'd have to get values in your Rec variable first, which is more processing. Also, you're doing an additional operation to your first example, so by definition that would take more time. I don't think this will save any time for you.
Even if it did, it's just one record you are modifying, that's not where you want to focus your attention when fighting performance issues.0 -
Freightliner wrote:Hi,
I heared from someone that sql modify could work faster when you do this:rec.RESET; rec.SETFILTER(...); rec.find('-'); rec.field := value; rec.MODIFY();
instead of :rec.RESET; rec.SETFILTER(...); rec.find('-'); rec2.COPY(rec); rec2.field := value; rec2.MODIFY();
is this true?
If it is, can someone give me some example to test this?
What's wrong with first example? :?
Why even bother to use second one ? :roll:
Unless there is some catch?
regards
Bostjan0 -
that's indeed the same as i thought, but as i think of it, would it be different if the value you change is the one in the filter?0
-
Freightliner wrote:that's indeed the same as i thought, but as i think of it, would it be different if the value you change is the one in the filter?
Yes it would be, but even more different if field is in the key that is used.
The second one is ](*,)
Bostjan0 -
in what sense would it be different then?
would the first be faster or the second one?0 -
Freightliner wrote:in what sense would it be different then?
would the first be faster or the second one?
It's not speed. In first version if you change value that is in the key and you are in the loop you can get "suprise" when NEXT-ing to the next record. ](*,)
Bostjan0 -
yes, but that is the same as in native.
So there would be no difference only for SQL?0 -
No, both statements are translated in an UPDATE-statements in SQL.
But like bostjanl said, it is needed to to avoid surprises in a loop (both Navision as SQL-DB). (Surprises : not all records are processed OR endless loop)Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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