[horde] Database cleanup horde_histories

Michael J Rubinsky mrubinsk at horde.org
Wed May 1 15:52:35 UTC 2019

Quoting Jens Wahnes <wahnes at uni-koeln.de>:

> Philipp Faeustlin wrote:
>> Hi is there a way to clean up the horde_histories database table?
>> It seem like entries in this table will never be removed. Not even  
>> if you remove a user per cli.
>> Is this supposed to work like this or is there something wrong with  
>> my installation of Horde?
> I'm having the same problem of a ever growing horde_histories table  
> as well. I think this behaviour is intended. The problem with  
> deleting stuff from the horde_histories table is that there can be  
> entries there by deleted users that are still needed. For example,  
> there could be a shared calendar that user X added entries to  
> (especially if it's recurring event) that are relevant even after  
> X's account is deleted. If one were to delete the entries of user X  
> in horde_histories upon deleting their other data  
> (horde-remove-user-data), the event in the shared calendar could not  
> be displayed properly anymore.

The history data doesn't really have anything to do with the *display*  
of entries. If the entry in question still exists in the application's  
backend storage, the entry will display fine. In general, the history  
data is used for synchronization of things like ActiveSync clients on  
a mobile device, or *DAV clients. If you don't care about  
synchronization it is generally safe to delete this information. Even  
if you do care about synchronization, it would generally be safe to  
delete REALLY old entries - basically as long as any clients you care  
about have synchronized since the history event date, you should be  

Note that history data might have auditing value in your organization,  
so that is also something to keep in mind as well.

> One thing that I've done in the past is to change the "history_who"  
> field of entries from users long deleted to "-system-" to anonymize  
> those entries for reasons of data protection. That should allow old  
> entries to still be used to reconstruct entries in shared calendars,  
> but not to keep personal data of people to longer relevant.
> Another approach I've taken is to specifically delete old entries  
> from horde_histories (of users long deleted) that refer to IMP. I  
> don't know if there can be entries of the "IMP" kind relevant to  
> other users still existing done by deleted users (maybe when using  
> shared mail folders?). Still I would want to get rid of them,  
> because "IMP" entries are by far the largest in numbers in our  
> setup, plus it's not that upsetting after all when one is unable to  
> look up the history of and old email (with the email itself still  
> being stored on the mail server). So with a MySQL database, I used  
> something along the lines of
> DELETE FROM horde_histories USING horde_histories LEFT JOIN  
> horde_prefs on (history_who=horde_prefs.pref_uid AND  
> horde_prefs.pref_name='last_login' AND  
> horde_prefs.pref_scope='horde') WHERE horde_prefs.pref_uid IS NULL  
> AND object_uid like 'imp:%' AND history_ts < 1483225200
> to remove very old "IMP" entries in horde_histories. So far this has  
> been working well for me, but I wouldn't want to bet that this is  
> the way to go.
> Jens
> -- 
> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org

The Horde Project
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 9272 bytes
Desc: PGP Public Key
URL: <https://lists.horde.org/archives/horde/attachments/20190501/563c7b9c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 821 bytes
Desc: PGP Digital Signature
URL: <https://lists.horde.org/archives/horde/attachments/20190501/563c7b9c/attachment-0001.bin>

More information about the horde mailing list