n8n Execution History Auto-Cleanup Workflow

This workflow is designed to periodically scan and automatically delete old execution records that have been running for more than 10 days, thereby maintaining a clean and efficient system and preventing redundant data from occupying storage resources. By regularly cleaning up expired execution records, users can effectively manage historical data, ensuring system performance and response speed. Additionally, it supports manual triggering for testing and debugging purposes, simplifying data cleanup operations for maintenance personnel and enhancing the operational efficiency of the automation platform.

Workflow Diagram
n8n Execution History Auto-Cleanup Workflow Workflow diagram

Workflow Name

n8n Execution History Auto-Cleanup Workflow

Key Features and Highlights

This workflow periodically scans and automatically deletes execution records older than 10 days, maintaining the cleanliness and efficiency of the n8n system while preventing redundant data from occupying storage resources. It also supports manual triggering for testing purposes, facilitating debugging and validation.

Core Problem Addressed

As n8n automation workflows continue to run, historical execution data accumulates, causing database bloat that negatively impacts system performance and increases maintenance costs. This workflow ensures system stability and responsiveness by automatically cleaning up expired execution records.

Use Cases

  • n8n automation platform users who need to regularly maintain execution history data
  • Enterprise automation process management to prevent excessive historical data from degrading system performance
  • Operations personnel seeking to simplify data cleanup tasks on the n8n platform

Main Process Steps

  1. Use the “Schedule Trigger” node to trigger the workflow at a fixed time daily
  2. Retrieve all execution records via the “n8n list execution” node
  3. Filter execution records with start times older than 10 days using the “If” node
  4. Delete qualifying historical execution records by invoking the “delete execution” node
  5. Perform “no operation” on records that do not meet the criteria to keep the workflow clear
  6. Support immediate testing through the “Manual Trigger” node

Involved Systems or Services

  • n8n Automation Platform API (used for querying and deleting execution records)

Target Users and Value

  • n8n platform administrators and operations personnel
  • Automation workflow developers focused on system performance and data management
  • Any users building automation workflows with n8n who require regular maintenance of execution history

By using this workflow, users can efficiently and automatically manage n8n execution history, reduce manual intervention, and enhance the operational efficiency and stability of the automation platform.