I've got a database which is getting quite large and slow to query. I only really need the last month of entries for most situations so I'm looking to create structure-copies of two of my tables and then regularly move data from the 'live' two into the 'archive' two if the records are more than a month old.
What is the best way to achieve this? Should I regularly perform checks from my application (C#) or would it be better to let MySQL handle this operation?

Recommended Answers

All 2 Replies

You can set a cron to run on every first day of the month, which will copy the record from main table to archive table[and delete entries in the main table].
We do it the same way in our company, but the data is archived on yearly basis. I also hope that your tables are neatly indexed as they play a vital role in the execution time of a query.

Ok, I'll look into MySQL cron. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.