n8n mysql purge history greater than 10 days

This workflow is designed to automatically clean up execution records in the MySQL database that are older than 30 days, effectively preventing performance degradation caused by data accumulation. Users can choose to schedule the cleanup operation to run automatically every day or trigger it manually, ensuring that the database remains tidy and operates efficiently. It is suitable for users who need to maintain execution history, simplifying database management tasks and improving system stability and maintenance efficiency.

Workflow Diagram
n8n_mysql_purge_history_greater_than_10_days Workflow diagram

Workflow Name

n8n_mysql_purge_history_greater_than_10_days

Key Features and Highlights

This workflow automates the cleanup of execution records in a MySQL database by regularly deleting historical execution data older than 30 days. It effectively prevents database performance degradation caused by data accumulation. The workflow supports both manual triggering and daily scheduled automatic execution, offering flexibility and convenience.

Core Problem Addressed

As the number of n8n workflow executions increases, the execution history records in the database continuously grow, resulting in increased storage burden and reduced query efficiency. This workflow helps users maintain a clean and efficient database by periodically purging expired execution records.

Use Cases

  • Users of n8n who store execution records in a MySQL database
  • Those needing regular database maintenance to prevent unlimited growth of historical data
  • Users seeking to simplify database cleanup tasks through automation

Main Process Steps

  1. Scheduled Trigger (Cron Node): Automatically starts daily at 7 AM
  2. Manual Trigger (Manual Trigger Node): Allows users to manually initiate the cleanup process
  3. Execute MySQL Delete Command (MySQL Node): Deletes historical records with execution timestamps older than 30 days

Involved Systems or Services

  • MySQL Database: Stores n8n execution history data
  • Built-in n8n Automation Nodes (Cron for scheduled triggering, Manual Trigger for manual execution, MySQL node for database operations)

Target Users and Value Proposition

  • n8n platform operators and developers, assisting in maintaining database performance
  • Database administrators, simplifying routine cleanup tasks
  • Enterprises and teams requiring automated management of historical data to enhance system stability and maintenance efficiency