B
B
BitRouter2017-11-21 03:19:56
MySQL
BitRouter, 2017-11-21 03:19:56

How is the mechanism of auto deletion / archiving of data in a MySQL table implemented upon expiration of time?

Good time dear colleagues!
I got into a stupor on a simple question ..
How to implement AUTO deletion or data archiving in SQL after, say, a year ...
The table content is straightforward:
ID - bigint (11) AUTO_INCREMENT
DATE_READ - datetime (0000-00-00 00:00:00 )
well, and further varchars ..
i.e. we have the date and time when the record gets into the table and exactly after say 365 days it should not be there anymore)) Without initiating direct queries, is it possible to implement this at the MySQL levels? If not, which one has any ideas?)) Thank you
in advance from the bottom of my heart!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
entermix, 2017-11-21
@BitRouter

You can use MySQL Triggers/Events/Procedures

B
Boris Korobkov, 2017-11-21
@BorisKorobkov

cron

A
Arman, 2017-11-21
@Arik

Good old =)

if(rand(0, 9) < 3) {
// archive
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question