Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a game - virtual soccer manager. It is browser based game. It is split into 'seasons' each of them takes around a half of a real year. The central game element is a soccer match, each team plays around 40-50 matches per season, there are roughly a thousand of teams.

Each match has a lot of match related data: game moments description, amount of experience earned by each team player during each match, etc...

Web site has around 200-600 users in different times and exists almost 8 years. For this time game get a ton of data. All data are saved in MySQL DB (5.1).

My problem is that tables size is growing constantly. It is not the problem on its own, but when I do some data maintenance (add new fields into existing tables, change field type, etc.) it takes a ton of time to execute those queries.

From one side, I don't really want to delete aged data (that is more than 5 years old) as potentially users could be interested in looking into them. from another side, 5 years old and older data are not really concerning and COULD be deleted.

Question: what is good practices for keeping/archiving data in general and for online games in particular?

P.S. Probably I should ask on another site?

share|improve this question

2 Answers 2

If you want to limit table size, I'd suggest to split single large tables into a few distinct separate tables.

For example, say you have a Matches table that records all matches that ever took place. If only the current season is what is relevant, create 2 tables: currentSeasonMatches and oldMatches. When a season is over, move all the old matches to oldMatches and clear currentSeasonMatches. Or, you could break the data by year: matches2011, matches2012, matches2013. of course, it all matters how accessible you need that older data to be.

If database server size is an issue, render all the data to an HTML tabular format that viewers can view, and save that on a static HTML page on your website. mysqldump the old data and put it in a cloud somewhere.

share|improve this answer

First, do a full database backup. After you do the backup, I also recommend you load that backup back into mysql and verify it isn't corrupt. Assuming it's not, put it in a directory that is part of your regular file backups. After that, simply delete the data from the database you don't need. Or selectively copy only the data in tables that are required to start another 'season'.

As for past users wanting to view data, simply make a few 'top 100' static lists for previous years. Top 100 lists have worked for me in the past, although nowadays I just do Top 10 of specific categories.

I do this after every 'season' and purge the previous seasons data from the database. Keeps everything in tiptop shape, and also makes it really easy to edit the database structure between seasons, as there is no data in there to worry about conflicts. Only concern is the code changes that might be necessary.

This is from my personal experience with my browser rpg's. I am by no means a qualified database admin, and have simply found the above to work well for my needs based on experience.

share|improve this answer
    
So literally you migrate ESSENTIAL data into a separate tables and delete at least from production data base all that legacy garbage? That makes some sense: in case if you need to get another "top 10" you can restore data locally and generate updated "top 10" for whatever season you need, right? –  Budda Apr 16 '13 at 1:12
    
That is one way, but I literally just delete the data from the main tables after performing a backup(and verifying it isn't corrupt). Then, if you want to make more top lists, just restore the backup to a new database so it doesn't overwrite your existing season. –  JClaspill Apr 16 '13 at 15:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.