I'm using Testing duration using activity log entry. for sample, I try to use Sales Header.
Total records = 52418 rows.
my codes :
ActivityLog.Description := 'Loop 5';
ActivityLog.Start;
SH.SETFILTER(SH."No.",'<%1',xxxx);
IF SH.FINDSET THEN
REPEAT
ActivityLog."No. of Operations" := ActivityLog."No. of Operations" + 1;
UNTIL SH.NEXT = 0;
ActivityLog.Stop;
testing 1 :
Keys = Doc type,No *** clustered = yes
Duration = 8900s ms
testing 2 :
keys = doc type,No *** clustered = No
new keys = No,Doc type *** clustered = yes
Duration = 9300s ms
testing 3 :
Keys = Doc type,No *** clustered = yes *** sqlindex = No,Doc Type
Duration = 17000s ms
The theory said that using testing 2 is the best because when we show statistic for this key will produce low density and if we are not setcurrentkey, sql will select this key itself (most selectivity) but why in my testing 2,time duration more higher than testing 1(high selectivity in sql statistic)
Another theory also said using sql index will boost our performance but why in my testing 3, the result is the worst? ](*,) ](*,) ](*,)
Any explaination about this experiment?
[/b]
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have done testing a lot of times,try to changing indexing, try and error and the result not same as theory said.:-k
need advices from Master Navision who experienced in tuning indexing... [-o<
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
For "testin" you selected wrong example. The effect is best to see when filtering for one exact value, not for a range like you did. In this case there much more to look at and the SQL planning engine will use many things with different priorities to create the execution plan.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
which example that I have to use? can you give me some codes for example and testing? my example want to prove for large data,which one is the best performance because my company's data is huge enough make it slow down.
rgds,
angelo
Example: if the "No." has these values ("compressed" description - number of codes beginning with given character):
125x A*
542x B*
10x C*
988x D*
451x E*
etc.
and there is 2500 records in the table, and if you will filter for something like "<EXXXXX", SQL will maybe count that it is better to scan the table, because it is 84% probability that each record will be inside the filter. It will not use the non-clustered index beginning with "No." field. But if you will filter "<BXXXXX" the probability will be different and may be that SQL will use the non-clustered index...
This is just example...
And do not forget to repeat the measuring more times and calc the average. Because just one test is about nothing. You need to have same conditions for all tests... ("warming up" the cache etc.)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.