开发者

How to implement a time series sampler in MySQL system?

开发者 https://www.devze.com 2023-03-02 16:47 出处:网络
I want to record the growth rate of values in columns of MySQL table. What is the quickest开发者_Go百科 way to implement a sub-program that automatically writes the values to another table at given-t

I want to record the growth rate of values in columns of MySQL table.

What is the quickest开发者_Go百科 way to implement a sub-program that automatically writes the values to another table at given-time intervals? combination of stored procs / triggers / functions?


I have a table that gets over 2 million detailed rows/day.

I have a trigger that writes summary data to another table. I summarize the data into 5-minute "buckets" by converting the original datetime, yielding about 350K rows/day.

After a week, I have a cronjob that rolls the 5-minute buckets into hourly buckets, even further reducing storage to about 80K rows/day.

We use the summary data for reporting and also for longer storage.

It's a poor-man's RRD structure.

Hope that helps.

0

精彩评论

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