Problem Description:
Once in the release system to production environment, suddenly found the report after several minutes also refresh not come out, small brother I directly panicked. Quickly carry out a variety of tests, the first right key report properties to find the report address to see if the parameters are transmitted correctly. Find the report parameters directly after running procedure, also can not run out. Open procedure A section of implementation is no problem, the implementation of the entire procedure content is no problem, but exec procedure_nm has always been a problem. It's okay to execute procedure in the development environment. So, began to tangle.
Environment: SQL SERVER 2008, SSRS 2008
Resolution process:
Think carefully about the difference between production environment and development environment, it is the development environment is a newly built environment, production is already existed for several years of environment, this time only to its report producdure changed, and played a patch to modify the previous half of the historical data. It turned out that this was the main cause of the event. By constantly looking for problems, we found the table statistics in the development environment and production (the bottom item after the table is expanded in the left target browser in SQL Server: Statistics). It was just a guess that a lot of new data would cause production statistics to be obsolete, and the SQL Server engine would make a series of data retrieval plans based on statistics when parsing procedure, just as there was a highway from city A to B, Now that the freeway is useless, the SQL Server engine is looking for other stupid methods, and the automatic updating of statistics will only happen in the dead of night. So they try to apply for a manual update of production statistics. After the statistics are updated, the report opens normally.
Workaround:
Use DATABASE_NM
EXEC sp_updatestats
Conclusion:
After a large amount of data is updated, the statistics of the database are changed, which in turn affects SQL Server parsing of SQL. You need to update the database statistics so that SQL Server has the latest and correct information to make the execution plan.