You Are Doing It Wrong

A friend got me into playing this online game. It is turn based. Slowly I have risen through the ranks. My character level is up. Often I want to compare my progress against the other players. Fine. I go to the ratings page.

Most of the time, I get an error message stating that I have accessed the ratings page too often. Then there is some whining about the page taking a long time to generate. I guess I am supposed to come back after a few days. What the heck is this? Some noob database programmers I guess.

From what I gather, the game was hacked together with some PHP. I think I may be able to get my hands on the code. There must be a MySQL database on the back end. Now there are around 1000 player total. I imagine they are running a query that orders players by level and maybe experience.

How hard could this query be? I find there are usually only 10 players on at a given time. I bet most of them are not clicking on the ratings page. Can we somehow cache this data? Heck they could even generate a static HTML page that gets refreshed every so often. Performance problem solved.

From a database point of view, why not create a materialized view? Then refresh that view at your leisure, as resources allow. Nobody should need up to the minute real-time player rakings. And if they do, charge them a premium. Right now I scraped the ratings pages. Going to play with the data a bit. Then I need that source code.