Solved

How to avoid Stored Proc ?

Posted on 2012-03-12
7
326 Views
Last Modified: 2012-04-05
Hi Gicks,

Here I have one scenerio.

There is one Stored Proc which contains 5000 LOC. During Execution of this Stored Proc, MDX query is generated dynamically. Based on this MDX query, SSRS report was built. It takes long time to display report.

- Is there any alternate way to avoid this Performance Issue. ?  
- Is there any alternate method to avoid this Stored Proc.

Regards
Raveen
0
Comment
Question by:Ravee123
7 Comments
 
LVL 15

Expert Comment

by:Tim Humphries
ID: 37713556
Hi,

I suspect that if the report takes a long time to run the problem is with the MDX or the cube structure rather than the time taken by the procedure to build the query.

Can you post the MDX generated? Presumably this varies depending on input parameters - a few examples of output from the procedure would be useful.

Thanks

Tim
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 37713565
>>Based on this MDX query, SSRS report was built. It takes long time to display report.

If the data for the report doesn't change (or only changes occasionally) then you could store the results into a temporary table and base the report on that table instead of generating the data each time you display the report.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37714749
What SQL Server version(s)/edition(s) are you using and what service pack levels?
Also, did you tried to manualy excute the stored proc against your SQL server to separate the backend from the front end report? If the stored proc takes long you need to optimize your code and/or add indexes but if the SP execution is reasonable then you need to optimize your SSRS environment(hardware/network/client?)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 37715452
OMG  No stored procedure should have 5,000 lines of code.  I agree with previous comments that you should consider splitting it up and then optimize each step.
0
 
LVL 25

Expert Comment

by:jogos
ID: 37715995
When having 5000 lines of code my guess it contains a lot of 'the same' but duplicated because of one or two things differ between handling type A, type B .... K .
0
 

Author Comment

by:Ravee123
ID: 37720185
Not Duplicated. It has different scenerios.

Hi,

I suspect that if the report takes a long time to run the problem is with the MDX or the cube structure rather than the time taken by the procedure to build the query.

Can you post the MDX generated? Presumably this varies depending on input parameters - a few examples of output from the procedure would be useful.

Thanks

Tim

Unable to post that SP and MDX is generated within this SP.
0
 
LVL 15

Accepted Solution

by:
Tim Humphries earned 500 total points
ID: 37720268
Hi,

But you can presumably run the sp in isolation and post the MDX that results from it in different scenarios. That may enable the MDX query to be better understood - as well as what the sp is doing and why the solution was implemented in this way in the first place.

If you can't run  the sp in isolation, you can use Profiler to capture the MDX being executed when the report runs.

Thanks

Tim
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question