Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I noticed a rollback for question edits. I assume this is a similar concept to version control or how we have on windows a system restore where it will rollback to any previous snapshot point.

My question is not limited to only StackOverflow but in general how does this site or other sites in general store this in the DB? If they use RDMs that means 1 entire row for each change. And a row can have even 50–100 columns when only 1 column was updated so lot of data being written again and again.

For StackOverflow this may be fine because at most a person may edit the question say 10 times so 10 new rows. But for something like say your interests which people updated each day that is like 1 update per person per day and have 10 million users so 10 million new rows each day of just historical data.

share|improve this question
What sort of databases are you designing that have 50 or even 100 columns per row? I rarely see that kind of thing in a well-designed database. Clearly you haven't normalized properly if you need to insert 100 values into a row just to track an update to 1 column. And even assuming that all 10 million members do 1 update per day on average (which is not going to be anywhere near the actual number), that's really not such an insane amount if the indexing is halfway decent. – Aarobot Dec 19 '10 at 3:52
This should be asked on Stack Overflow proper. If you want to know how the rollback system works in this system, please edit your question. – Jon Seigel Dec 19 '10 at 16:41
possible duplicate of howto track data changes in a database table – Adam Davis Feb 17 '11 at 18:39

If you look at the schema for the data dump, you get your answer.

Specifically, revisions to a post are stored in the PostHistory, and it contains the pertinent information like what was revised. I'm guessing that they have some way to say which order these revisions come in; but it being 8:49am and me just waking up, I don't see it.

share|improve this answer

Prior to the previous database optimization spree (about a year ago) each new version was stored as a new text block in a new row. Stackoverflow would convert the newest version to HTML and store the HTML in another table with one entry per post.

In this way, finding and displaying the latest version was simple - find the postid, get the row in the HTML table, and send it to the client. On an edit, store the new version whole in the history table, and convert it to HTML and update is one HTML record.

Now, I describe two tables there, but there may have been only one table, I don't recall exactly, but I do recall that they convert the markdown to HTML and serve the HTML. This caused some interesting bugs early on (posts being truncated, but going into edit mode would "revive" them), but it certainly lowers the load on the server since the conversion doesn't happen every view.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .