Decimal fields in keys
AntidotE
Member Posts: 61
Good day comrades.
I would like to ask, maybe someone knows: is it acceptable to use decimal field(s) in keys (in primary also)? If acceptable, will it be performance-breaking or normal?
Thanks in advance for constructive answers.
I would like to ask, maybe someone knows: is it acceptable to use decimal field(s) in keys (in primary also)? If acceptable, will it be performance-breaking or normal?
Thanks in advance for constructive answers.
It is hard to swim against self bloodstream... (c) Old, experienced kamikadze.
0
Comments
-
Personally I would never do it, but hey, I've seen a lot of posts writing about "unusual" things done with NAV so what the heck, go for it!0
-
Thanks for reply
Well... as soon as I finish current task, I'll make some investigation in this topic and post here
But, still expect for more activity!
Did anyone see/use such stuff? Was it good in performance with millions of records?It is hard to swim against self bloodstream... (c) Old, experienced kamikadze.0 -
DISCLAIMER: this is my personal interpretation and can be wrong.
actually, nav standard uses decimal fields in some keys (also in pk): i don't think it's a good practice, but as rhpnt said, sometimes is just needed!
i would care about the correct fillfactor to use, bacause a decimal field can be inserted almost anywhere in the index, thus i would select a low fillfactor (don't ask me how much), especially if the decimal field is one of the first fields in the key.
As a rule of thumb, if you go for it (and if it's possible for your businnes logic) you should put that decimal field as one of the last fields in the key.0 -
Thanks for reply.
Customer wanted primary key like this:"Metal Sheet Group" Code20 "Sheet Thickness Min" Decimal "Sheet Thickness Max" Decimal
I told him that he will get performance down, proposed and implemented solution with the following key:"Code" Code20
This field has automatic increment, it is unique and unchangeable for user.
Other fields, proposed by customer, are implemented, but are not in key.
now I start creating simple table with customer supposed key, fill it with millions of random data and test access performance.It is hard to swim against self bloodstream... (c) Old, experienced kamikadze.0 -
hmm... well, with 2 decimals in key even with searching among only 500'000 records it takes around 30 seconds on my computer.
with only one code20 in key i get ~15 seconds...
so, performance is realIt is hard to swim against self bloodstream... (c) Old, experienced kamikadze.0 -
I have not so powerful computerIt is hard to swim against self bloodstream... (c) Old, experienced kamikadze.0
-
Couldn't help myself not to follow the thread.
I believe that the table you are trying to put that weird key in is a "combination" table combining the metal group with different thicknesses which has to be unique!?
The solution without using the "unusual" key would be that you check the unique thickness by code. This is very simple, just put the checking routine in the onInsert and onModify trigger of the given table and voila you've created a check constraint.0 -
2Belias: sql so far. looking for random value from specified range by pk.
2rhpnt: I did something like thatIt is hard to swim against self bloodstream... (c) Old, experienced kamikadze.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