So, the next question would be, well, why not DynamoDB? Obviously there's trade-offs, this isn't gonna be a trade-off-free decision. So, the first big kind of thing is that it's an Amazon-only thing, so people get worried about that. This isn't actually technically totally accurate, though there are examples of people cloning Dynamo now for other key-value stores, so we saw this happen with a lot of other Amazon services, like S3 very famously, it's cloned quite a bit now. So, that'll probably continue to happen.
A very valid criticism, though, is that it's just a bit weird to learn. So, modeling for a wide-column key-value store is very query-centric, you'd have to think about how you wanna get the data before you store it, unlike relational data, where we denormalize everything and we can kind of query ad hoc. And the other thing that's a bit weird is that the query syntax is a bit strange. It's not as same as relational, although I would argue that this is just a familiarity thing if you had learned Dynamo first and then learned Postgres after you'd probably find Postgres weird, so not really a major thing.
Why non-DynamoDB also has a bunch of myths, and I wanna address these head-on. So one of the first myths is that it's expensive, another one is that you need to know all of your access patterns completely upfront before you do anything, that's not true. I've heard that it's hard to modify and migrate, that's also not true. Sometimes people say you can't use SQL, that's not true, and we'll address the biggest red herrings of all, lock-in and scaling at the end, cause it'll be funny.
So, first one is, is it expensive? Well, the DynamoDB Free Tier gives you 25 gigabytes stored on disk per month for free, and it's 25 cents for every gigabyte after that. That's a lot of starter data, 25 gigs, it's a ton. From a, that's just on disk, what it costs. You also have to pay for read and write, and basically it works out to about 200 million requests per month is gonna be in the free tier. So, storing 25 gigs, 200 million requests per month. I think this is not expensive at all, this is very cheap. And so, even if, as you scale you find these numbers to just get out of hand, it still speaks to using Dynamo for at least prototyping your application. It's gonna get you really far, for very little. As a side, the joke I used to like to say is like, yeah, Dynamo's expensive but so are DBAs. And that joke really only lands if you've had to shard a database. So, I'm not gonna make the assumption that anyone knows what I'm talking about there.
Another big myth is that you need to know access patterns upfront. So DynamoDB modeling is different than relational database modeling, and it's just different, it's not better. It's just different. And so, in both databases, relational or key-value, you need to have a schema of some kind. You need to say that these values are expected and that's how I'm gonna query for stuff. So, it really doesn't matter which database you choose. At some point, you're going to have to declare a schema.
Comments