Interviewer - Server > Administration and maintenance > Databases > Maintaining databases > Maintaining the session history table (ApplicationSessionHistory)
 
Maintaining the session history table (ApplicationSessionHistory)
The ApplicationSessionHistory table records activity usage information. The table grows quickly when many users are running monitored activities. This section provides guidelines for maintaining the ApplicationSessionHistory table.
1 UNICOM Intelligence provides an option to disable activity monitoring or the monitoring of web interviews. Entering or exiting the specific activity is not recorded in the ApplicationSessionHistory table when the property EnableMonitoring = False is added under DPM > Site > Server > Applications > [Application] > ApplicationSettings.
For example, to disable monitoring for web surveys, add DPM > Site > Server > Applications > WebSurveys > ApplicationSettings > EnableMonitoring = False.
2 Use the UpdateConcurrentUsage stored procedure to clean up the ApplicationSessionHistory table. The UpdateConcurrentUsage stored procedure does the following:
calculates the maximum concurrent activity usage from the ApplicationSession and ApplicationSessionHistory tables, and writes the summarized data to the ApplicationSessionUsage table.
deletes expired data from the ApplicationSessionHistory, CatiInterviewerSessionHistory, CatiInterviewSessionHistory, CatiSupervisorSessionHistory and UserSessionHistory tables. The stored procedure has a parameter @SessionHistoryDataExpiresInDays, with a default value of 365. Cleaning of the ApplicationSessionHistory table does not occur when @SessionHistoryDataExpiresInDays is set to 0.
To call the UpdateConcurrentUsage stored procedure, use this code:
--This will calculate concurrent usage and remove sessions started more than 365 days ago from session history table.
Exec UpdateConcurrentUsage
--This will calculate concurrent usage, but will not clean the session history.
Exec UpdateConcurrentUsage 0
It is recommended that a SQL Server Agent Job be created to call the UpdateConcurrentUsage stored procedure. The job should be scheduled to run daily on the mrUserData database (when the database is idle). For more information, see the Microsoft MSDN article “Schedule a Job”:
http://msdn.microsoft.com/en-us/library/ms191439.aspx
See also
Maintaining databases