Well, after some examinations and some optimization ideas I tried to figure out how to gain some performance.
First of all I realized that View0 only returns the results in about 6 seconds. But when I performed the View1 again I have seen that I have mistaken. Apparently it seems that 20 seconds is totally wrong. The problem is that the SQL Server performs the query, returns some part of the results, pauses for execution, returns some other portion etc. in about 256 rows chunks. 20 seconds was the time elapsed for some portion only, and I have mistaken to miss that the whole query has not been finalized yet.
After a full query execution I figured that the total execution time is about 250 seconds as well. After a discussion with my boss we have changed the query style. Instead of forming the View1 from View0 we have created a table that has the same structure with the resulting View0. Then created a stored procedure that performs the following:
1 - Empty the table contents
2 - Run the query as we create View0 and push data into the table
3 - Save data contents
4 - Now perform another query to retireve the results that the View1 should bring.
Then we have,
bound this stored procedure to the report as data source.
Results: The stored procedure completes the whole task in about amazing 7 seconds versus View's 250 seconds. But the performance increase while displaying the report was actually not that amazing. But eventually we have managed to gain a 35%, reducing the total time down to about 270 seconds. Still too long to view a report but preferable against View's 400 seconds!!!
There seems that, there is not an easy or significant way to improve the performance for us at the moment. But why is the report so slow????
Originally posted by BrianBischof
But one thing that jumps out at me is to ask how many rows are in our final report?
the answer lies in the number of results returned. My view or stored procedure returns about 4000 lines of records which spans more than 80 pages of report. Even the query is completed at a considerable time, preparing the forms and displaying 4000 records take too long I guess. Since I don't have much experience on Crystal Reports, that idea might be false, but it seems the only way that makes a sense explanation.
Edited by utkuozan - 28 Jun 2007 at 11:47pm