Please share the data type of $timestamp (normaly mysql tables should use the timestamp data type, but mediawiki uses strings, requiring some conversion). Also provide how many rows you intend to delete and what are the needs (e.g. avoid large deletes- for which there are specific tools like pt-archiver). Also please say which language you want to use for automation. Based on those needs we can better advice on what is best to do.

On Sat, Apr 7, 2018 at 4:05 PM, MarcoAurelio <strigiwm@gmail.com> wrote:
Hi,

thanks for your reply.

I do too run from time to time a query like yours: "DELETE FROM logging WHERE l_timestamp < 20180201000000;" for example; however I have to manually set the timestamp. Ideally we should perhaps move to have a coded garbage collector on our tool instead of doing this ourselves manually.

Regards, M.

2018-04-07 15:55 GMT+02:00 Maximilian Doerr <maximilian.doerr@gmail.com>:
That should technically work, but you want to be sure you have the timestamp column indexed.

Based on what I’m seeing, it looks as if you mixed PHP in there.

Here’s how my garbage collector works for my IABot interface.


Cyberpower678
English Wikipedia Account Creation Team
English Wikipedia Administrator
Global User Renamer

On Apr 7, 2018, at 09:41, MarcoAurelio <strigiwm@gmail.com> wrote:

Hi,

I'd like to issue a command to a database our team manages to clean all data older than 30 days.

Browsing around I've found that:

DELETE FROM $table WHERE $timestamp < NOW() - INTERVAL 30 DAY

could work, but I'd like to check with you first just in case you have a better command or ideas.

Thanks in advance for your help.

Best regards, M.
_______________________________________________
Wikimedia Cloud Services mailing list
Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/cloud


_______________________________________________
Wikimedia Cloud Services mailing list
Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/cloud


_______________________________________________
Wikimedia Cloud Services mailing list
Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/cloud



--
Jaime Crespo
<http://wikimedia.org>