Settings

Theme

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

5 points by chromedude 12 years ago · 7 comments · 1 min read

Reader

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?

kellros 12 years ago

From a technical viewpoint it all comes down to the CAP theorem and what is priority: 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 12 years ago

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 12 years ago

    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.

  • carlosdaniel 12 years ago

    This "good for X, it should be good for me" is something that bothers me, take php for example, if it is good enough for Facebook it should also be good enough for everybody, doesn't it?, sure, Facebook makes it work for them, but they spent a lot of resources to get there (they even made their own vm HipHop), that does not mean your startup has or want to spend that kind of effort and resources with it having now potentially better alternatives under your given use case?

jlengrand 12 years ago

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 12 years ago

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.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection