Solved

How to avoid Stored Proc ?

Posted on 2012-03-12
7
319 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 51

Expert Comment

by:tedbilly
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

759 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