Sales Order Entry very slow load

SOLVED

We have an issue where SO Entry is extremely slow to load. I ran a trace using SQL profiler and it appears to occur when a query is made to obtain a list of comm plans (SELECT CommPlanID, CommPlanKey FROM tarCommPlan WHERE CompanyID = X and CompanyID = X). It takes the client a minute and a half to complete this task and this is the only place I see the client stalling. In profiler the trace sits there for 1min 30secs then zooms through to completion.

I tried running the query directly in SQL it is lightning fast.

We have a highly optimized SQL DB and server, so I am left wondering what the issue is. We only have about 8.5k of commission plans, so I don't think that would cause big issues, so maybe this is an issue in the client rather than the server. One thing that strikes me as odd is that the where clause states the CompanyID twice.

I have ruled out customizations by testing on a normal client and on another company. This has been going on for years, so it is not a new occurrence.

Does anyone else have this happen? Once the client is loaded it runs fine. There are no other issues in accessing data as far as I am able to ascertain.

  • 0

    In your trace are you using sp:StmtStarting and sp:StmntCompleted?  If not add those as well as the query plan XML from the performance events.  The query plan will generate between the two sp: events mentioned.  Re-run your trace and check the query plan as well as the following in the sp:stmntCompleted line:

    • Duration
    • Reads
    • Writes
    • CPU

    This will give you a little more information as to what is occurring.   If the time to complete the statement is quick and the trace hangs on the completed statement in the trace before the next statement records, then I would tend to believe the issue is network/client related and not SQL Server.

  • 0 in reply to LouDavis

    Thanks Lou.

    Yes I'm using those settings. The XML execution plan is less than a second and the command actually being run is

    exec sp_prepexec @p1 output,NULL,N'SELECT CommPlanID, CommPlanKey FROM tarCommPlan WHERE CompanyID = 'X' AND CompanyID = 'X'

    I don't feel it is SQL, so maybe it is just something peculiar in our data that the SO Entry activity does not like. Very strange and frustrating.

  • 0 in reply to Jima

    Jim,

    I know you said it's fast in SQL but I'd try and rule out it 100%.  First I would delete and rebuild the indexes.  If that doesn't work then I'd drop and reload the table.  I assume it's slow when you access it on a test server...  When is the last time you ran DBCC ('DB')?

    John

  • 0 in reply to JohnHanrahan

    Thanks John.

    I typically run DBCC as part of a routine maintenance schedule every weekend and yes, same on the test server. Index rebuild did not work unfortunately.

    To double check I ran a full maintenance process on the DB but no luck there.

  • 0 in reply to Jima
    verified answer

    Ok my first suggestions are unhelpful.  Upon actual review I see that the code is loading a combo box.  I will bet you a trip to England (actually let's make it Paris) that if you delete 90% of your commission plans it will be fast.  Your only hope is to either reduce the number of commission plans or get someone to customize the screen so it's a lookup instead of a combo box.  :(

  • 0 in reply to JohnHanrahan

    Thanks John, that confirms my suspicions. I will try suggesting this to Sage.