Hi everyone,
I've a pretty strange behavior here: i've tried to profile it and i identified a single, long running query, but i can't figure out what can have generated it.
Specs:
nav2009r2 build 32775
sql 2008r2
But first, a litlle explanation:
I have a list of serial numbers, and a factobox that shows every item ledger entry related to that serial no.
properties of the factbox part in my page:
subformview SORTING(Serial No.,Posting Date)
subformlink Serial No.=FIELD(Code)
if i run the page through obj designer (as explained, it's a list with a factbox list) everything works fine, but if i access the list through the rolecenter menu, the following query is fired. This query takes 30 seconds to execute, because it reads 310133 records.
SELECT TOP 1 * FROM mydb$Item Ledger Entry" WITH (READUNCOMMITTED) ORDER BY "Serial No_","Posting Date","Entry No_" OPTION (OPTIMIZE FOR UNKNOWN)
:-k I am figuring out something while i'm writing, just tell me if i'm talking s**t
"Serial No.,Posting date" key is not maintained on the item ledger entry (maintainsqlindex = false), but i have "Serial No.,Responsibility Center Code,Source No.,Location Code" key that is actually maintained. Actually, ordering by this latter key make the page works smoothly, but why sql can't see this key if i'm running the page through role center?!?!
Thanks in advance for your inputs! I hope I explained it clearly!
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
1. does not apply the subformlink property
2. apply the Subformview property (but the key is not maintained and nav have to sort the entire table with an unexisting key)
----> fires a query. (long running)
3. apply the subformlink property.
----> fires a query. (fast even with an unmaintained key, because of a tiny recordset)
actually, the first query is useless, and is only fired when the main page is embedded in the role center...if you run the same page not "embedded", the process is:
1,2,3,query! That in my opinion is the correct procedure. This evening i'm installing the latest hotfix in our test environment and we'll see if it solves the problem. Otherwise, i'll report it to Microsoft.
Thanks for Now
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
i spent one hour trying to figure out where does that TOP 1 query was started (after giving it up :whistle: ,search the problem somewhere else and ask here)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
https://connect.microsoft.com/dynamicssuggestions/feedback/details/689087/slow-factbox-on-rolecenter
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thanks to Duilio Tacconi of the italian CSS team for his effort and competence! =D>
In the meantime, I found a workaround to avoid the issue: set the sorting key through SETCURRENTKEY in the onaftergetrecord trigger, and remove every single sorting property (sourcetableview in the factbox and subformview in the FB part of the main page). It's weird, but this is the only way to make it work fast
PS: no, the onopenpage trigger does not work
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Soooooooo, go for the workaround, for now
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog