Live data from Hacker News

PG: What's your current take on reddit's comment system?

reddit.com

1–10 of 67 posts

Re: PG: What's your current take on reddit's comment system?

#3
Incidentally I came across this while trying to find information about how reddit stores threaded comments. I've read they use postgres and while I've also read about many workable techniques to force hierarchical (and frequently reordered) comments into a relational db these solutions all sort of make me cringe. I'd welcome anyone's ideas here as well.

Re: PG: What's your current take on reddit's comment system?

#4
post #3

Incidentally I came across this while trying to find information about how reddit stores threaded comments. I've read they use postgres and while I've also read about many workable techniques to force hierarchical (and frequently reordered) comments into a relational db these solutions all sort of make me cringe. I'd welcome anyone's ideas here as well.

I did a quick and dirty forum a couple years back that now serves up hundreds of new threads a day (having tens, sometimes hundreds of messages each).

My solution was to store a comment thread in display order in the database with hinting as to how deep in the heirarchy the comment is. Optimizes for output, although with some cost every time something gets posted. Luckily, for most forums, views outnumber posts by hundreds of times.

The one issue that system has is that if you're doing a lot of reordering, let's say from quality scores. In that case you'll basically have to remake the thread after every post and after vote that makes a difference. Not recommended...

Re: PG: What's your current take on reddit's comment system?

#5
post #2

While reddit's comment system is obviously an improvement over Slashdot's, I'm increasingly convinced that community makeup is far more important than the tool it uses.

I agree, basically. Except I think customs are as important as or more important than makeup. That's why I try to discourage ad hominems.

To be fair to the reddits, it wasn't their fault that the discussion on reddit sank down toward that of digg and slashdot. They have really strong beliefs against censorship. They were never going to jump into a discussion and tell people to stop being jerks. But empirically it looks as if you may have to.

The optimistic way of phrasing this is: if you have good customs and existing users enforce them, you can probably survive the influx of 14 year olds when it comes.

Re: PG: What's your current take on reddit's comment system?

#6
post #3

Incidentally I came across this while trying to find information about how reddit stores threaded comments. I've read they use postgres and while I've also read about many workable techniques to force hierarchical (and frequently reordered) comments into a relational db these solutions all sort of make me cringe. I'd welcome anyone's ideas here as well.

i am in the process of making a news.yc clone... threaded comments are not as easy as it looks on news.yc.

[edit] especially when the comments get reordered on votes.

Re: PG: What's your current take on reddit's comment system?

#7
post #6
post #3

Incidentally I came across this while trying to find information about how reddit stores threaded comments. I've read they use postgres and while I've also read about many workable techniques to force hierarchical (and frequently reordered) comments into a relational db these solutions all sort of make me cringe. I'd welcome anyone's ideas here as well.

i am in the process of making a news.yc clone... threaded comments are not as easy as it looks on news.yc. [edit] especially when the comments get reordered on votes.

If you're trying to mimic this forum with a database solution, it's going to be a pain. PG's keeping this stuff in memory, almost certainly as the tree that it is.

edit on the edit: scratch that.

Re: PG: What's your current take on reddit's comment system?

#8
The one issue I have with the comments are they are not in chronological order and reorganize as new posts are added. It is annoying to figure which messages you have already read and which you have not since they are all mixed together. A simply chronological thread would be nice.

Re: PG: What's your current take on reddit's comment system?

#9
post #5
post #2

While reddit's comment system is obviously an improvement over Slashdot's, I'm increasingly convinced that community makeup is far more important than the tool it uses.

I agree, basically. Except I think customs are as important as or more important than makeup. That's why I try to discourage ad hominems. To be fair to the reddits, it wasn't their fault that the discussion on reddit sank down toward that of digg and slashdot. They have really strong beliefs against censorship. They were never going to jump into a discussion and tell people to stop being jerks. But empirically it loo…

Did anyone point out to the reddits that telling someone to stop being a jerk is not censorship?

Re: PG: What's your current take on reddit's comment system?

#10
post #3

Incidentally I came across this while trying to find information about how reddit stores threaded comments. I've read they use postgres and while I've also read about many workable techniques to force hierarchical (and frequently reordered) comments into a relational db these solutions all sort of make me cringe. I'd welcome anyone's ideas here as well.

The approach I took on Diffle (http://www.diffle.com/ - unfortunately it hasn't been exercised as we haven't really got traction yet) was to store the comment ID as a varbinary(255). A child comment takes the ID of the parent and then appends a 2-byte sequential number. So, the first comment is 0x0001, the second is 0x0002, a reply to the second is 0x00020001, a second reply is 0x00020002, the third is 0x0003, a reply to the third is 0x00030001, etc. To find the children of a comment, you look for all comments where the parent's ID is a prefix. MySQL can use leftmost-prefixes as indexes, so this computes very quickly. Also, with the standard varbinary collating order, 0x01 sorts before 0x0101, 0x0102, 0x02, etc, so all I have to do is order by the ID and everything will come out in proper threaded order. And nesting depth is calculated easily by len(id) / 2.

Reordering can be done just by looking at all records whose IDs contain the parent as a prefix and have a length 2 greater than the parent, and then renumbering them. This should be computationally feasible in most cases.

This does limit users to 65,536 replies to a single comment, and a maximum comment nesting depth of 127. Based on my experience with some very active LiveJournal threads, I considered these to be acceptable limitations (LJ limits comments to 5000/post anyway). A nesting depth of 127 would be nearly 2400 pixels over, so it's not like it'd all fit on one screen anyway.

Post reply on HN