MySQL Forums
Forum List  »  Newbie

Activity table need clearing
Posted by: Andrew Hodkinson
Date: March 04, 2016 05:45PM

In my database I have a activity tables which logs various user activities, such as "last login". The problem is this table has become huge and I don't really need all the data which is kept in there.

Until now the table has been cleaned up by removing all activity older than 30 days, but I would like to change this to retain the last 100 results per user, and clear everything else. This means if a user hasn't logged in for 6 months, we still have a record of "their" latest activity.

The structure looks something like this:
activity_id int(10)
activity_user int(10)
activity_datetime datetime

I am a little stuck on the logical solution for this.

Options: ReplyQuote


Subject
Written By
Posted
Activity table need clearing
March 04, 2016 05:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.