March 7, 2008 at 10:30 pm
I've been wondering what the best way to track a voting system in a database. Not a ranking system, but maybe just straight visits or something like that.
Think about the YouTube site. Its super fast to do a straight insert into a child table, and you basically have to for a ranking system of votes, but what about tracking the visits. Assuming you wanted to put that fact into a database, would it be more practical to just tack another column on the parent table, and increment it by one every time, and suffer the update hit or just have a child table with one column? Anyone have a strong option or some experience with large databases like this?
March 10, 2008 at 7:12 am
If you need just visit count, add a count column to the parent table, if you want more data on each visit (timestamp) , need to analyze visits (ie distribution), make a detail table.
I would create a detail table, as you can simulate the count field in parent table with a view, easily expand detail table with additional columns if needed.
Super fast?
insert into a detail table is fast. With proper FKey the selects will be fast too.
March 10, 2008 at 7:30 am
I'd say it depends on the volume and how quickly you are returning data. I might use two tables, one to record logins/activity in a straight insert and one to do counts. Or you could periodically roll up activity into another table for reporting.
March 10, 2008 at 3:06 pm
Thanks for the feedback. I've thought about it a bit more too, and will probably go with a child table for the quick insert (to the user), then if performance gets to be a drag on the reporting side, maybe add a summary column and roll up the values periodically as you mention.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply