Which Database Brand to use in System Design Interviews?

MongoDB? Cassandra? GraphQL?

This seems like a common confusion among candidates. If you are asked to design a backend system, more than likely you will need to include a database. For scalable backends, these are generally in two categories – NoSQL databases such as HBase, Cassandra, MongoDB, etc. and Relational (SQL) Databases such as MySQL and Amazon RDS.

However, we highly recommend that you stay away from using particular brands, at least at first. What’s a better approach? Say that you will use a Distributed Key-Value Store, or even better, a Wide Column Store (if you’re comfortable with those). This moves the conversation away from how a specific database works to a general discussion of database design.

(Caveat: of course, if you have significant experience in MongoDB and the company uses MongoDB then you want to mention that, but we still recommend you say something like “a NoSQL store such as MongoDB”. This shows that you know that you can use other DBs).

The best way to bring it up is by saying something like this: “To store users, we can use a NoSQL Wide Column store. They provide scalability out of the box”. If the interviewer asks you specifically for names, or if you know the internals of HBase, you can say “wide-column store such as HBase”.

Note: Before you enter discussions of NoSQL databases, make sure to ask your interviewer if your system needs to scale to a lot of users. If the system doesn’t need to scale much, then you might not need a NoSQL DB, and a simple relational database might suffice.

Why shouldn’t I just say I will use MongoDB for my system?

Well, there are two scenarios – either the interviewer knows internals of MongoDB or they don’t. If they know internals of MongoDB, they can grill you on it, so that’s up to you. More commonly, they won’t know internal details of MongoDB, so they will try to steer the conversation towards general databases. Why would you want that when you can just say “Distributed DB such as MongoDB”.

Besides, it shows that you are open to considering other systems and not religious about MongoDB.

Ok iCamp, but isn’t it more efficient to use an out of the box database than to make your own?

In the real world, sure. In a system design interview, they want to see if you can design such a system yourself. More often than not, they want to go into internals of how you would implement/scale such a database. Truth is, anyone can use an existing DB, they want to see if you can come up with one yourself.


Please enter your comment!
Please enter your name here