Solved

How to avoid Stored Proc ?

Posted on 2012-03-12
7
324 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 39

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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

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.

Question has a verified solution.

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

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…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

912 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now