When to use SQL or NoSQL
-
@scottalanmiller said:
And people wanting to say that they are "database programmers" - what does that even mean?... And so many people think that half of IT is DBAs even though none of them have ever met one.
During the twenty-or-so contracts I've worked as a software engineer, I've met probably half a dozen DBAs, and only one of them actually wrote SQL for our application. The rest of it was done by developers. I'm sure somewhere there is a person doing nothing but write stored procedures and database functions, but I have yet to meet them.
-
@scottalanmiller said:
GiE is a must have for VoIP today! And I need QoS on my massive GigE switch or I won't be able to make my 100Kb/s phone calls!
What? I've always went cheap with the phones that only have 100mb anyway.
-
@tonyshowoff said:
We deal with both MySQL and a few different NoSQL databases as well. It really depends on the scenario, but if you don't know, then you can just use a regular relational database.
In general though you don't need a lot of data to justify MongoDB or Cassandra (we use both, though we're slowly transitioning to only Cassandra), in the same way you don't need to be doing relational or financial things to justify MySQL or anything like that.
NoSQL works best for key-value store, as in you already know the information you want, it likely isn't directly related to anything else and so probably doesn't need to be joined (joins tend to be very expensive in NoSQL if supported at all), and you don't need to worry too much about the same level of consistency. So some examples:
- Sessions
- Logs or user activity
- Expensive but rarely rebuilt things from your relational database for permanent caching
There's also the issue of heavy writing, as NoSQL databases tend to be faster at writes than reads, which is why we use it for really write heavy things that either we do not need back right away or we allow the user to keep (when they make a comment, show it based on what they put, instead of getting it back, for example).
Relational databases can be used for all the same things as NoSQL databases and many actually do a fairly good job at it, and you don't really need to worry about the differences until you get hundreds of thousands or millions of requests (like us) per day.
Aside from that MySQL (and others) have been around for years, are highly tested in large environments, etc and anything which is relational, would need to be associated with things in other tables (foreign key scenario for example), dealing with financial information, etc.
When you don't know or don't have the environment or resources to test, then always just use your relational database, it's probably the right choice anyway.
If you are curious, in our environment for our adult content sites, we've got about 630 servers so and we use MySQL, MongoDB, Cassandra, and memcached (and Apache, nginx, and PHP), and our other products and services we use similar setups but usually either MongoDB or Cassandra, and like I said we're trying to transition to it as we've gotten more out of it and better performance for us. I've noticed a lot of issues with MongoDB and returning things in reverse order (even with a reverse index) and also paging this way, it's painfully slow compared to Cassandra (1 - 2 seconds compared to 400ms or so; doesn't seem like a lot, but keep in mind that's on top of other loading, so loading new comments or whatever on some of our older sites is up to 3 seconds, and most people start to feel things are "too slow" after about half a second.), so I suggest maybe not even bothering with MongoDB unless it fits some other scenario of yours.
Thanks for the info!
-
If you are interested in learning more about NoSQL, I highly recommend this book (and highly recommend buying it directly from the awesome publisher....)
-
Great book!
-
@mlnews said:
If you are interested in learning more about NoSQL, I highly recommend this book (and highly recommend buying it directly from the awesome publisher....)
Thanks! It looks like this is my next book to buy!