Mysql minified dynamic table related to time

We have a database with data associated with it. As you can imagine, it grows (and slows down) over time. There are 50% read and 25% inserts and 25% data refresh actions (this month), 100% older data read.

  • Okay, old data is also becoming less important.
  • The bad news is that sometimes we need to query the entire period from present to last year.

Now I want to have a mysql architecture that serves younger data faster than older data.

Is there a way to do this in mysql?


post scriptum: Of course, since we are working with rubies on rails and active writing at the application layer, we can easily rewrite the active class of the active write to access multiple tables and move the old data to another table. BUT, because we also read queries from other systems such as reports that need to have access to old and new data, and sometimes one at the same time, I would like to solve it in mysql.

+2


source to share


2 answers


Partitioning MySQL was pretty much made for you. This requires you to be on 5.1.



+3


source


I would split the table into (at least) 2 tables and store the current data in one and archived data in the other. Then use the MySql view to create a "virtual" table that can be used when all the data is required, otherwise the required data is accessed directly using the actall table.



+1


source







All Articles