PmaControl logo PmaControl
  • Home
  • PmaControl
    • AI Agents 13 on-premise agents
    • Plans Community, Cloud, On-Premise, Premium
    • Documentation Guides, API, architecture
    • Changelog Every stable 5.x release
    • Marketplace Community plugins
    • Clients 28+ companies
    • FAQ 25 questions / 7 categories
    Databases
    • MariaDB 38 articles
    • MySQL 16 articles
    • Galera Cluster 6 articles
    • MaxScale 4 articles
    • ProxySQL 3 articles
    • Amazon Aurora MySQL 0 article
    • Azure Database 0 article
    • ClickHouse 0 article
    • GCP CloudSQL 0 article
    • Percona Server 0 article
    • SingleStore 0 article
    • TiDB 0 article
    • Vitess 0 article
    Solutions
    • Support 24×7 MariaDB & MySQL emergencies
    • SQL Observability Monitoring, alerts, topology
    • High Availability Replication, failover, Galera
    • Disaster Recovery Backup, restore, RPO/RTO
    • Security & Compliance Audit, GDPR, SOC2
    • Migration & Upgrade Zero downtime, pt-osc, gh-ost
  • Plans
  • Resources
    • Documentation Technical guides & API
    • MySQL optimization center Markdown index, metrics, parameters, incidents
    • FAQ 25 frequently asked questions
    • Testimonials Client feedback & use cases
    • Blog Articles & insights
    • Roadmap Upcoming features
    Areas of expertise
    • SQL Observability Monitoring, alerts, Dot3 topology
    • High Availability Replication, failover, Galera
    • Security & Compliance Audit, GDPR, SOC2, ISO 27001
    • Disaster Recovery Backup, restore, RPO/RTO
    • Performance & Optimisation Digests, EXPLAIN, tuning
    • Migration & Upgrade Zero downtime, pt-osc
    Quick links
    • GitHub Wiki 26 pages — install, engine, plugins
    • Source code Official GitHub repository
    • Support 24×7 MariaDB & MySQL emergencies
    • Book a demo 30 min — real architecture
  • Support 24×7
  • Book a demo
Book a demo
🇫🇷 FR Français 🇬🇧 EN English 🇵🇱 PL Polski 🇷🇺 RU Русский 🇨🇳 ZH 中文 🇸🇦 AR العربية
← Back to blog

Purging 40 records and restoring 480 rows with Cleaner

Published on December 3, 2026 By Aurélien LEQUOY
mariadb mysql cleaner archivage pmacontrol
Share X LinkedIn Facebook Email PDF
Purging 40 records and restoring 480 rows with Cleaner

Deleting a training record sounds straightforward until you look at an attendance entry. It refers both to the participant’s enrolment and to the session attended. Two paths lead to the same row. I demonstrated this problem in Barcelona in 2019. I revisited it in PmaControl with a synthetic database of 24 tables and 4,320 rows.

Read the graph before deleting

My first prototype relied on lists of tables. One new application table could leave a list incomplete. The graph lets us review what actually depends on a record. The short path is dossier → inscription → presence. The second goes through parcours → seance before reaching the same attendance entry. Its primary key lets Cleaner count it once. A programme still shared by several records must survive. Cleaner’s live graph shows 9 affected tables out of 24.

PmaControl dependency graph for the nine affected workshop tables

The schema contains 29 SQL constraints. A thirtieth relationship is declared in Cleaner between note_dossier.dossier_id and dossier.dossier_id. The application knew about this link, but MariaDB did not enforce it. This virtual relationship accounts for the 80 notes attached to the 40 records in scope.

Check the selection and bound the batch

Of the 160 records, 40 were closed before 1 February 2025. The 120 open records serve as controls. In the preview I check the filter, sample keys, archive destination and execution plan. The index on cloture gives an estimate of 40 candidates here, confirmed by a separate count.

Cleaner preview showing the closing-date filter and batch limits

I allowed five root records per batch and capped the total at 120 rows across all tables. Each batch removed 5 roots and 55 dependent rows. After eight batches, the statistics and archives agree on 480 deletions, including 120 attendance entries. In production, the appropriate setting depends on child counts, locks and replication lag.

Cleaner statistics and deletions broken down by table

Prove that the archive can be restored

In Barcelona I showed a historical replica and files transferred at the end of the day. The current preview states that normal replication remains active. This test uses Cleaner’s local export. Each batch writes its data and schema with SHA-256 checksums before deletion. A schema change invalidates approval. After an interruption, the batch journal distinguishes confirmed transactions from those that need reconciliation before resuming.

I copied the 3,840 surviving rows into a restore database, verified the checksums of the eight committed batches and replayed their archives newest first with constraints enabled. This brought back 4,320 rows. An ordered comparison found identical values in all 24 tables, including the fifteen outside the purge scope. That is the check I want to be able to repeat before running a purge in production.

Barcelona talk · Cleaner documentation

Share X LinkedIn Facebook Email PDF
← Back to blog

Comments (0)

No comments yet.

Leave a comment

Paste a screenshot with Ctrl+V (Cmd+V on Mac) or choose an image.

Up to 3 images, 2 MiB per image.

PmaControl
contact@pmacontrol.com
About Privacy Legal notice GitHub Developers Contact
Do not wait for an incident to understand your architecture. © 2014-2026 PmaControl — 68Koncept