Automated MySQL Data Cleanup for n8n Execution History
detail.loadingPreview
Streamline your n8n instance by automatically purging old execution data from your MySQL database. This workflow ensures optimal performance and efficient storage management.
About This Workflow
This n8n workflow is designed to automate the critical task of cleaning up your MySQL database by removing old n8n execution records. By targeting execution_entity entries older than 30 days, it prevents your database from accumulating unnecessary historical data. This proactive approach not only saves valuable storage space but also significantly improves the query performance of your MySQL database, leading to a more responsive and efficient n8n environment. The workflow offers flexibility with both manual execution and scheduled triggers, allowing you to integrate data hygiene seamlessly into your operational routines.
Key Features
- Automated Deletion: Configurable deletion of n8n execution data based on age.
- Time-Based Filtering: Targets records older than a specified period (default: 30 days).
- Scheduled Execution: Ability to run the cleanup automatically at a set time each day.
- Manual Trigger Option: Allows for on-demand execution for immediate cleanup.
How To Use
- Add Nodes: Begin by adding a 'Cron' node for scheduling and a 'MySQL' node for database interaction.
- Configure Cron: Set the
triggerTimesin the Cron node to your desired daily execution time (e.g., hour 7 for 7 AM). - Configure MySQL: In the MySQL node, select
executeQueryas the operation. Paste the following SQL query into thequeryfield:DELETE FROM execution_entity WHERE DATE(stoppedAt) < DATE_SUB(CURDATE(), INTERVAL 30 DAY). - Set Credentials: Configure your MySQL
credentialsto connect to your database. - Connect Nodes: Connect the 'Cron' node's output to the 'MySQL' node's input to enable scheduled execution.
- Manual Execution (Optional): Add a 'Manual Trigger' node and connect its output to the 'MySQL' node to allow for on-demand cleanup.
Apps Used
Workflow JSON
{
"id": "911d61b6-c846-4dcd-aa8a-3c9b1bb41315",
"name": "Automated MySQL Data Cleanup for n8n Execution History",
"nodes": 8,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 911d61b6-c846...
About the Author
N8N_Community_Pick
Curator
Hand-picked high quality workflows from the global community.
Statistics
Related Workflows
Discover more workflows you might like
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Visualize Your n8n Workflows: Interactive Dashboard with Mermaid.js
Gain unparalleled visibility into your n8n automation landscape. This workflow transforms your n8n instance into a dynamic, interactive dashboard, leveraging Mermaid.js to visualize all your workflows in one accessible place.