Best way to delete the tenant data from all tables in the multi-tenant architecture
We need to implement a tenant offboarding/data deletion pipeline across multiple microservices using shared tables in PostgreSQL and ClickHouse. All relevant tables contain a tenant_id.
We're weighing two options:
- Static Registry: Manually maintain a mapping of target DBs and tables (hard to scale and maintain).
- Dynamic Discovery: Query metadata tables (
information_schema,system.columns) at runtime to find and delete from all tables with atenant_id.
Are there better architectural patterns or alternative solutions (e.g., event-driven soft deletes, CDC pipelines, or orchestrators) to handle this cleanly at scale?
u/manubhat — 2 days ago