Ask HN: How do you determine which database(s) to use for a project?
This is probably a stupid sounding question, but it really confuses me. How do I decide whether to use MongoDB or Redis, Redis or MySQL, PostgreSQL or MongoDB etc. for a specific project? Is it just a matter of taste or are each one optimized for certain use cases? I've heard of Redis being good for a cache, but then I hear some people just using it as their database. Which should I use it as?
7 comments
[ 281 ms ] story [ 953 ms ] threadNot mentioning all the other factors that are involved in choosing a database (ex. current staff skills, who will be maintaining the project if you decide on x but everyone uses y, what licenses do you already have etc.), you should consider the CAP theorem when choosing between a RDBMS, NewSQL, document based, graph based, key-value or file based storage.
Each database was designed to solve a specific problem, even though most databases are advanced enough for general use cases (ex. you can use a RDBMS in a similar fashion to a key-value store).
I'd say unless you have tried out what's available, it's going to be hard to make a choice - so get started!
1. I am comfortable with MySQL
2. If its good enough to run Facebook, then its good enough for me
For most purposes all databases do fine. You really have to base the choice on how familiar you are with the product, and what other technologies work well with the product. For example, if you're a Microsoft shop, you'd probably go with Microsoft SQL.
When you have cache/scalability problems, then think about changing. It won't happen in 99% of the times :).
I usually go for Mongo, simply because I don't have to change from my code to SQL, which saves time.