sql optimization

NavStudent
Member Posts: 399
Hello I've been looking at how navision does findasyoutype on sql. And this is very costly. I was simply searching on name
On SQL Navision runs the following statement.
This takes 1700 ms and the number does go down as you keep searching for the field but.
Most of the time whe you are searching (Ctrl +F), you are looking for one record. So why isn't Navision client sending
The empasis is the Top 100, or even better top 10
This improves performance a lot.
while I was running the test, I was running
DBcC dropcleanbuffers
dbcc freeproccache
To clear the cache so that I would get same results.
Thank you.
On SQL Navision runs the following statement.
SELECT * ,DATALENGTH("Picture") FROM "Test"."dbo"."Pharm$Customer" WHERE (("Name" LIKE '%p%')) ORDER BY "No_" OPTION (FAST 10)
This takes 1700 ms and the number does go down as you keep searching for the field but.
Most of the time whe you are searching (Ctrl +F), you are looking for one record. So why isn't Navision client sending
SELECT top 100 * ,DATALENGTH("Picture") FROM "Test"."dbo"."Jason$Customer" WHERE (("Name" LIKE '%p%')) ORDER BY "No_" OPTION (FAST 10)
The empasis is the Top 100, or even better top 10
This improves performance a lot.
while I was running the test, I was running
DBcC dropcleanbuffers
dbcc freeproccache
To clear the cache so that I would get same results.
Thank you.
my 2 cents
0
Answers
-
There are more issues with this search. If you are using some charset with accents, the search select can look like:
SELECT .... where Name = '%[Mm][AaÄäÁáâĂ㥹][CcĆćÇç][Hh][OoÖöÓóÔôŐő][Vv][AaÄäÁáâĂ㥹]%
If you enable the Match case option, the select will look like:SELECT ... where Name = '%Machová%'
And if you are using case-insensitive collation, it doesn't matter, if you select this, because it will find any variant of the string. It means you can search faster if you select the "Match case" when using CI collation and there is one additional gain: in some languages (like Czech) where are special "double character" (like 'ch' in Czech - it is one character in our alphabet) will this option grant you correct searching when using the local collation for sorting...0 -
I see.
It still doesn't anser, why they wouldn't add TOP 100 or TOP 10 in the sql statement.my 2 cents0 -
Because of support for the native database?
No one loves you like the one who created you...0 -
They are two different clients. fin.exe and finsql.exe.
Navision has also added finset,findfirst, etc as well.
What I'm asking when it translates the navisision find dialog into sql statement.my 2 cents0 -
Those SQL statements are generated by the executables, you can't change those. Every time MS comes out with new exe's, they make small improvements to the SQL statements.0
-
DenSter wrote:Those SQL statements are generated by the executables, you can't change those. Every time MS comes out with new exe's, they make small improvements to the SQL statements.
I know that. I'm asking why Navision finsql.exe calling the top Number, it will save a lot of processing power.my 2 cents0 -
And you really expect these forum members to answer that?
Please do a product suggestion via the MS site.0 -
Mark Brummel wrote:And you really expect these forum members to answer that?
Please do a product suggestion via the MS site.
Fair enough. A link would where this is would be helpful.
The reason I was asking it here, to see if I was missing something and the suggestion I had wouldn't be right in certain scenarios.
Thank you.my 2 cents0 -
[Topic moved from Navision forum to SQL Performance forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
The reason for not "TOP 10" is because the type of ODBC cursor being used.
When "OPTION (FAST 10)" is used at the end of the statment (within a cursor) SQL creates a FFO or Fast Foward only cursor, it returns the first 10 rows but leaves the cursor open and then essentially fetches the rest. It is not as nice as TOP 10, but NAV would need to change the logic to the whole NDBCS.DLL to change this.
The reason the statement is slow is not becuase of the "TOP" or cursor type it is because of the "LIKE" in the where clause. LIKE is very expensive. Hence the reason "Find as you Type" is so costly. Not sure how you would redesign that?0 -
Nobody wrote:The reason the statement is slow is not becuase of the "TOP" or cursor type it is because of the "LIKE" in the where clause. LIKE is very expensive. Hence the reason "Find as you Type" is so costly. Not sure how you would redesign that?
Remove the "Find as you type"-toggle from finsql.exe.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
If only they would do that.. :-)
There are many customers who flat out refuse to turn it off.
One way I found to "somewhat" mitigate the effect is compile a list of all the fields the users will use with "find as you type" and create single column non-clustered indexes on them. This is really more to get field statistics than anything else but it does help somewhat.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