SQL and Wrong Key

ldreamsl
Member Posts: 33
Hi to all,
I have a problem, we have moved the DB on a Sql server, and in some situations the performances of the system am notably lowered.
Looking for to understand something, we have performed the Trace with the Monitor client.
What we have ascertained that some time, to a SetCurrentKey ( Key1, Key2...), SetRange ( Key1,..) in Navision, it corresponds a totally wrong use of the key in SQL.
Does some know how to says me the because?
I have a problem, we have moved the DB on a Sql server, and in some situations the performances of the system am notably lowered.
Looking for to understand something, we have performed the Trace with the Monitor client.
What we have ascertained that some time, to a SetCurrentKey ( Key1, Key2...), SetRange ( Key1,..) in Navision, it corresponds a totally wrong use of the key in SQL.
Does some know how to says me the because?
God does not play dice with the universe. [Albert Einstein]
0
Comments
-
What is your Navision client version? There were similar bugs in early navision SQL versions.0
-
SQL decides which key to use, based on the DB-statistics (you should run these automatically each day, for example after the daily backup). The SETCURRENTKEY of Navision is translated into an ORDER BY on SQL. So don't be alarmed if SQL uses another key to find the records.
See also my response in http://www.mibuso.com/forum/viewtopic.php?t=7235Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:SQL decides which key to use, based on the DB-statistics (you should run these automatically each day, for example after the daily backup). The SETCURRENTKEY of Navision is translated into an ORDER BY on SQL. So don't be alarmed if SQL uses another key to find the records.
See also my response in http://www.mibuso.com/forum/viewtopic.php?t=7235
With the Client Monitor, I get: Time server: 300 ([ms]), then much fast the SQL Query, while, Elapsed Time: 25.000 ([ms]), anyone has determined this loss of time? and because?
Thanks.God does not play dice with the universe. [Albert Einstein]0 -
I am just guessing:
I think that "Server time" is the time the CPU of the server was occuppied to find the records. "Elapsed Time" is the time it needed to do it, this because other processes also used time in the same moment and they had to share the time.
Maybe someone else has a better idea.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
he that torments me is the following: I enter from Form to a Table with a lot of records, Random, some time goes all normally, other time stops and be necessary wait a long time before that is frees.
Then is not possible that a time uses the key near, and an other be wrong key, I don't understand the motive of this.
This happens since are passed to the SQL DB.God does not play dice with the universe. [Albert Einstein]0 -
-could it be that there are flowfields on the form and that sometimes some of them are not shown and other times they are shown? If a flowfield is not shown on the form, it is not calculated, so the DB does not lose time the get the data.
-it can also be that there is some extra processing on the form that sometimes doesn't trigger and sometimes it does.
-it can be that the first time it is slow, and the next times it is fast. This is because the next times, the data is in the DB-cache and it is faster to get the data. But this means something is read from the DB with bad indexes (Some filters on the table, some flowfields that are calculated with bad indexes)
These are all guesses.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:-could it be that there are flowfields on the form and that sometimes some of them are not shown and other times they are shown? If a flowfield is not shown on the form, it is not calculated, so the DB does not lose time the get the data.
-it can also be that there is some extra processing on the form that sometimes doesn't trigger and sometimes it does.
-it can be that the first time it is slow, and the next times it is fast. This is because the next times, the data is in the DB-cache and it is faster to get the data. But this means something is read from the DB with bad indexes (Some filters on the table, some flowfields that are calculated with bad indexes)
These are all guesses.
The
FilterGroup(2);
..
SetRange(..)
..
FilterGroup(0)
It may influence on the speed ???
On SQL the FilterGroup as they act??God does not play dice with the universe. [Albert Einstein]0 -
FILTERGROUP will not influence the speed. It justs sets another filtergroup.
This can be used to put a filter in another filtergroup, and then getting back to filtergroup 0 to avoid that the user can see a filter or change it.
It can also be used to put 2 filters on the same field.
Eg. Give me all customers with an 'a' in their name and a 'b' in their name.SETFILTER(Name,'%1','*a*'); SETFILTER(Name,'%1','*b*');
This will only retain the last filter.SETFILTER(Name,'%1','*a*'); FILTERGROUP(6); SETFILTER(Name,'%1','*b*'); FILTERGROUP(0);
This takes both filters.
In short : the filtergroup itself does not influence the speed. The SETRANGE,SETFILTER in a filtergroup influences the speed like a SETRANGE,SETFILTER without filtergroup.[/code]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I am known the operation of the filtergroup. I wanted only know if the client in the translation in SQL istruction was able somehow influence the performances. The fact is that in the native DB works correctly, in the SQL DB are introduced this problems. Doesn't know more thing think.God does not play dice with the universe. [Albert Einstein]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