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:
@@ -296,6 +296,8 @@ CREATE INDEX IF NOT EXISTS idx_audit_logs_actor
|
||||
ON audit_logs(actor_user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_audit_logs_tenant_action
|
||||
ON audit_logs(tenant_id, action);
|
||||
CREATE INDEX IF NOT EXISTS idx_audit_logs_created_at
|
||||
ON audit_logs(created_at);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS knowledge_tags (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user