

Ask HN: How do you determine which database(s) to use for a project? - chromedude

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&#x27;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?
======
kellros
From a technical viewpoint it all comes down to the CAP theorem and what is
priority:
[http://en.wikipedia.org/wiki/CAP_theorem](http://en.wikipedia.org/wiki/CAP_theorem)

Not 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!

------
Sealy
I chose MySQL based on two very non-technical reasons.

1\. I am comfortable with MySQL

2\. If its good enough to run Facebook, then its good enough for me

~~~
anywherenotes
MSSQL is also available at any hosting environment I ever looked at. Although
PostgreSQL might be available as well now everywhere, MSSQL was a no brainier
for web at some point (unless you had extra money to invest in a database for
your online app).

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.

------
jlengrand
I'd say go for the one you know how to use, to build faster. Keep in mind that
you might have to change later for some reason, so build high level enough.

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.

------
hashtree
It doesn't have to be an either or proposition. Check out highscalability and
you will see that it is common to use 2 to 4 types. Types being key/value,
columnar, relational, document, and graph. All have serious pros and cons over
one another.

