开发者

best practice in mysql?

I need to store historical 开发者_StackOverflow社区data for something in mysql (only last 7 days) - should I just make an extra column for each or what is the acceptable way to?


if you want to store historical data for last 7 days only,
add a date-time column to store the record creation time-stamp,
and setup a cronjob to periodically remove the records which old than 7 days

if you are using file-based data (csv),
make sure categories data into different date,
and each file contains a single date,
use the find command to remove (I assume you are using linux)

find -type f -mtime 7 -xargs rm {} \;


You should create table history with columns (data, date) if I understood correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜