Database maintenance
It is essential to monitor and maintain your database capacity to ensure optimal performance of Nintex RPA server. As data accumulates, a database nearing its storage limit can cause performance degradation, most notably preventing scheduled tasks from triggering. The following are some best practices when maintaining database storage.
Checking Available Storage
Monitor your remaining free space regularly. Use the following SQL query to check your current database capacity:
SELECT
DB_NAME() AS DatabaseName,
name AS FileName,
size/128.0 AS CurrentSizeMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB,
(size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0) / (size/128.0) * 100 AS FreeSpacePercentage
FROM sys.database_files
WHERE type_desc = 'ROWS'
AND data_space_id = 1; -- This filters for the PRIMARY filegroup
Purging Historical Records
If your database is approaching its limit, we recommend purging records older than three months to free up space and maintain system health. Execute the following query to clear these older records:
delete from [history].[tasks_history] where created_at < DATEADD(MONTH, -3, GETDATE())
delete from [history].[tasks_summary] where created_at < DATEADD(MONTH, -3, GETDATE())
delete from [tasks].[tasks_task_data] where task_allocation_time < DATEADD(MONTH, -3, GETDATE())
delete from [queues].[queues_task_data] where task_create_time < DATEADD(MONTH, -3, GETDATE())
delete from LeoLogInHistory where LogInTime < DATEADD(MONTH, -3, GETDATE())
delete from LeoStatistics where Time < DATEADD(MONTH, -3, GETDATE())
delete from [history].[user_runtime_action_history] where created_at < DATEADD(MONTH, -3, GETDATE())
Maintenance Best Practices
Establish a recurring maintenance cadence tailored to your organization's usage. Environments with higher transaction volumes will consume database capacity faster and require more frequent trimming.