Hello,
I implemented a OWL device to check power.
Working well; I use database saving values and in my web interface, I use highcharts to plot the history (highcharts.com).
Now, I have too many records in my database and I'd like to clean it for records older than x days.
The idea is to launch an event (midnight ?) to clean database every day.
Until now, I didn't found the method... do you have any idea ?
Kind regards.
Clean Database - delete records older than x days
Moderator: RDNZL
Re: Clean Database - delete records older than x days
Must be doable by logging in to the database:
Are in the output from this last command the values you want to delete?
If so, you can use a command like:
Code: Select all
$ mysql -u domouser -p --database=domotiga
mysql> show tables;
mysql> select * from device_values_log;
If so, you can use a command like:
Code: Select all
delete from Table where dateadd(month, 2, lastchanged< getdate()
Re: Clean Database - delete records older than x days
Hello,
OK, I'll try this method.. I'll give you feedback as soon as I check...
Thanks & best regards
OK, I'll try this method.. I'll give you feedback as soon as I check...
Thanks & best regards