title: comment system rdbms vs nosql
body: <p>What is the best way to implement a commenting system (huge data writing)?</p>
  
  <p>1) Use a RDBMS database such as MySQL, 2 tables one for the topics and one for the comments
  <strong>Pros</strong> is that the insertion of new comment is fast, efficient and simple, efficient indexing. <strong>Cons</strong>  is that scaling out (horizontal scaling) is hard.</p>
  
  <p>2) Use a nosql database such as couchdb or mongodb, <strong>Pros</strong> is that scaling out (horizontal scaling) is easy, Supports huge data writes, schemaless <strong>Cons</strong> <em>I think</em> that the insertion of new data is not fast and efficient as the RDBMS</p>
  
  <p>For example to update couchdb document you need to grab the whole document, update it locally the submit it again, and the document size will be huge so it will consume bandwidth.</p>
  
  <p>Also I think that couchdb in-place updates, Mongodb updates would be slow and won't be efficient as in RDBMS </p>
  
  <p>Also when you want to get the comments of the each user in various topics I think the search would be faster in RDBMS than in the nosql system.</p>
  
  <p>That is a sample of couchdb database document [document sample for each topic]</p>
  
  <pre><code>{"_id":"doc id",
   "_rev":"45521231465421"
   "topic_title":"the title of the topic"
   "topic_body":"the body of the topic"
   "comments":[
             {"date":"mm/dd/yy hh:mm:ss"}, {"commment":"bla1"}, {"user":"user1"}
             {"date":"mm/dd/yy hh:mm:ss"}, {"commment":"bla2"}, {"user":"user2"}
             {"date":"mm/dd/yy hh:mm:ss"}, {"commment":"bla3"}, {"user":"user3"}
             {"date":"mm/dd/yy hh:mm:ss"}, {"commment":"bla4"}, {"user":"user4"}
             {"date":"mm/dd/yy hh:mm:ss"}, {"commment":"bla5"}, {"user":"user5"}
             {"date":"mm/dd/yy hh:mm:ss"}, {"commment":"bla6"}, {"user":"user6"}
              ]
  }
  </code></pre>