I'm working on a site similar to digg in the respect that users can submit "stories".
I keep track of how many "votes" and "similar adds" each item got. Similar adds are defined as two users adding the same "link".
Here is part of the algorithm (essentially the most important):
y = day number
sy = number of adds on day y
∑ y[1:10] sy / y
So basically calculate the number of "similar adds" on a specified day and divide by the number of seconds since the content was posted. Do this for the past 10 days (as an example).
However, I'm not sure how to implement this so that it performs well. Every method I can think of will be really slow.
The only way I can think of implementing this is by calculating the number of adds for the past 10 days for each item submitted will take forever. (so a sql command with a group by date executed 10 times for the past 10 days - obviously this method sucks).
Even if I keep a table that I update once a day (and run the above sql in the background), that will still be ridiculously slow once the database gets large. Plus the rating will be "outdated" since it's not live (e.g. breaking news "items" will never reach the top).
Does anyone have any experience of how to go about doing this?