-
Notifications
You must be signed in to change notification settings - Fork 444
Description
Summary
It would be useful if django-auditlog could optionally create or use a PostgreSQL partitioned table for its LogEntry model.
This would allow large audit logs to scale more efficiently by leveraging native partitioning.
Current Behavior
Currently, LogEntry is created as a single monolithic table via Django migrations.
All audit entries are written to that table through the ORM.
This design works fine for small and medium volumes, but when audit data grows into tens or hundreds of millions of rows, retention and query performance degrade significantly.
Django itself can work with partitioned tables transparently (when the parent table handles inserts), but django-auditlog doesn’t provide a clean way to:
- create the
LogEntrytable as partitioned, - manage partitions (by date, etc.), or
- configure a custom table for the
LogEntrymodel.
Desired Behavior
Provide an option or documented pattern to allow:
- Automatic or manual creation of partitions (daily, monthly, etc.).
- A Django setting or model option to specify:
AUDITLOG_PARTITION_BY = 'timestamp'
AUDITLOG_PARTITION_INTERVAL = 'month'This would let large installations keep audit data long-term while maintaining manageable table sizes.