feat(migration): add index on created_at for audit_logs
Introduced an index on the created_at column of the audit_logs table to optimize the daily retention sweep, improving performance by reducing the need for full table scans during deletions. This change enhances the efficiency of the retention process, particularly for tenants with high RBAC traffic. The corresponding down migration includes the removal of this index. Refs: #1303
This commit is contained in:
@@ -17,6 +17,7 @@ BEGIN
|
||||
RAISE WARNING '[Migration 000044 down] Dropping audit_logs — durable history will be lost';
|
||||
END $$;
|
||||
|
||||
DROP INDEX IF EXISTS idx_audit_logs_created_at;
|
||||
DROP INDEX IF EXISTS idx_audit_logs_tenant_action;
|
||||
DROP INDEX IF EXISTS idx_audit_logs_actor;
|
||||
DROP INDEX IF EXISTS idx_audit_logs_tenant_id_desc;
|
||||
|
||||
Reference in New Issue
Block a user