I'm running a cleanup process each month that deletes old unnecessary objects from the database. Is there a way to get an estimation of the file size gained from the cleanup process?
I'm working with both sqlite3 and PostgreSQL DBs, but of course a DB-independent solution would be preferred.
Looks like a good estimation would be to go to each object in the queryset, iterate though the
__dict__
values, and call__sizeof__
upon every object.Given that the queryset is
qs
:Of course, this is a very basic estimation that doesn't take account many complicated implementations.