I started working on my site a little bit ago and I’m presently using CosmosDB for the backend datastore for it.

Now Azure’s CosmosDB is a no-SQL, non-relational database. It’s also a lot more flexible than AWS’s DynamoDB by a lot. I also grew up with relational databases as my everyday bread and butter.

So when I was starting to make a set of “tables” I just kept on creating collections in CosmosDB like they were tables. Everything in it’s place as it were.

Then I noticed that the billing rate went up. The minimum resource units (RUs) is 100 * Collection Count with a minimum of 400. I wound up with seven with the tables I’d made. It also turns out that if you’ve ever had more than four collections, you’re limited by the maximum number you’ve ever created.


But that’s when I started thinking.

The way the CosmosDB is set up it has a concept of partitions. As long as you can provide documents that have a element that can be used as the partition key in that collection, you’re good. You don’t have to bother trying to segregate data that would normally be in other tables. The only thing you need to keep apart are things that have a very different way of access and keys.

So I tore everything down and recreated. Now instead of seven tables, I have just three.

And my billing has calmed down as well.