SQL index field order different from NAV defined field order

davmac1
Member Posts: 1,283
Is there a utility available that will let me compare the SQL index field order compared to the Navision defined field order?
I have come into a situation where I found the contact list was extremely slow because someone decided to change the field order of several of the indexes in SQL Server (not in the NAV key property).
I would like to be able to run a comparison with all Navision defined keys versus SQL indexes and show all indexes that have a different field order.
If I had to write this, I think I would need to have a program that read all the Navision keys - maybe from text files, and then formatted queries to read the SQL table key properties.
(In case you are wondering, I can't find anyone who knows the history of decisions at this installation.)
I have come into a situation where I found the contact list was extremely slow because someone decided to change the field order of several of the indexes in SQL Server (not in the NAV key property).
I would like to be able to run a comparison with all Navision defined keys versus SQL indexes and show all indexes that have a different field order.
If I had to write this, I think I would need to have a program that read all the Navision keys - maybe from text files, and then formatted queries to read the SQL table key properties.
(In case you are wondering, I can't find anyone who knows the history of decisions at this installation.)
David Machanick
http://mibuso.com/blogs/davidmachanick/
http://mibuso.com/blogs/davidmachanick/
0
Comments
-
davmac1 wrote:Is there a utility available that will let me compare the SQL index field order compared to the Navision defined field order?
I have come into a situation where I found the contact list was extremely slow because someone decided to change the field order of several of the indexes in SQL Server (not in the NAV key property).
I would like to be able to run a comparison with all Navision defined keys versus SQL indexes and show all indexes that have a different field order.
If I had to write this, I think I would need to have a program that read all the Navision keys - maybe from text files, and then formatted queries to read the SQL table key properties.
(In case you are wondering, I can't find anyone who knows the history of decisions at this installation.)
Was this done directly on SQL or was it done using the SQL Index property in Navision?David Singleton0 -
davmac1 wrote:I can't find anyone who knows the history of decisions at this installation.Regards
Peter0 -
pdj wrote:In previous versions of NAV it used a different cursor type, which often made it a good idea to change the SQL Index without changing the key.0
-
The problem is dumb is done and moved on, and I am left with the results.
What we need is a Navision definition / SQL Server compare tool to show where changes have been made directly to SQL Server and thus do not show up in Navision.
Anyone know of one?David Machanick
http://mibuso.com/blogs/davidmachanick/0 -
Google search on "index columns from SQL Server".
The first link looks promising:
http://stackoverflow.com/questions/7658 ... -server-db
This one is real easy:
http://blog.sqlauthority.com/2007/12/18 ... d-columns/
Run this script in the demo database to get a full list of indexes:
sp_helpindex 'dbo.[std2009R2$Item Ledger Entry]'
Do you also need help getting key information out of NAV?0 -
Thanks for the links.
I think the virtual NAV table "Key" is the best place to retrieve the NAV keys.
Do you have any other suggestions?David Machanick
http://mibuso.com/blogs/davidmachanick/0 -
-
David Singleton wrote:davmac1 wrote:I have come into a situation where I found the contact list was extremely slow because someone decided to change the field order of several of the indexes in SQL Server (not in the NAV key property).
Was this done directly on SQL or was it done using the SQL Index property in Navision?DenSter wrote:pdj wrote:In previous versions of NAV it used a different cursor type, which often made it a good idea to change the SQL Index without changing the key.
We still didn't get an answer to my original question. It's quite possible that this was done using SQLIndex. Sometimes becasue the property is hidden by default it is not noticed.David Singleton0 -
DenSter wrote:Still a dumbass move to do that directly in SQL Server though. That's what the SQLIndex property was for.
But as David mention, then davmac1 still haven't answered his question...Regards
Peter0 -
pdj wrote:In most cases yes, and I have always done it using NAV as well. However, I can easily imagine a situation where different companies have a very different usage of NAV and therefore different optimal Index'es. This can not be done using the SQLIndex property in NAV.
If you need different indexes in different companies, you add all of them. It's better to take the performance hit of the extra index overhead than to have a database with conflicts in the table design.0 -
Sorry - I thought I was being clear:
"I have come into a situation where I found the contact list was extremely slow because someone decided to change the field order of several of the indexes in SQL Server (not in the NAV key property)."
It was not done using the SQLindex property.
Disabling, compiling, then re-enabling the keys fixed the problem.
Plus new companies added did not have this problem.David Machanick
http://mibuso.com/blogs/davidmachanick/0 -
davmac1 wrote:Sorry - I thought I was being clear:
"I have come into a situation where I found the contact list was extremely slow because someone decided to change the field order of several of the indexes in SQL Server (not in the NAV key property)."
It was not done using the SQLindex property.
Disabling, compiling, then re-enabling the keys fixed the problem.
Plus new companies added did not have this problem.
Yes clear now, when you said NAV Key property, you meant SQLIndex. It makes sense now.David Singleton0 -
My two cents: I absolutely agree with Daniel that it would be stupid to change NAV "indexes" on SQL without using the "SQLIndex" property. But: with NAV 3.70 this property was not available, thus, if you had to optimize some indexes you had to do it on SQL site (in some cases). So maybe the database originates from those times?
And even though this could be considered an advertisement, well, yes - there is a tool around to compare NAV Perception with SQL Reality when it is about "Keys" and "Indexes" 8)
(And beware: there are still other tools around which screw up your indexes from outside NAV #-o )Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
You are right - it did originate in 3.7.
I am not sure why chenging the field order on keys used for lookups was considered a good idea unless they were tryingto optimize write transactions.
Maybe I can use this as a reason to recommend your performance tools.
I will get more info from you on your site.
BTW - I have your bookDavid Machanick
http://mibuso.com/blogs/davidmachanick/0 -
stryk wrote:But: with NAV 3.70 this property was not available, thus, if you had to optimize some indexes you had to do it on SQL site (in some cases).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