Reputation: 5129
I'm building a multi level commenting system and need a solution for quick reads and writes.
I've looked into adjacency list and nested set and it seems to me that for my particular scenario neither is the right method to use, so I'm looking into non RDBMS solutions as well.
What I would like to achieve:
I feel like the best solution for RDBMS is adjacency list, where you have recursive reads. But this is very inneficient because there will be thousands of reads per minute. Nested set is great for reads, but I will have lot of writes too which will make it really slow and inefficinet.
Do you know any other techniques that I could use here? Maybe other types of databases?
Upvotes: 0
Views: 341
Reputation: 32377
Most comment threads are very small in size ...less than a few K. So rather than storing each comment as it's own record in the database, you can store the entire comment graph as a single object. This will make it very easy to read and write the comment tree quickly.
This method lends itself very well to a shared cache ala redis or memcached.
Upvotes: 1