My database bill is too high !(Part 1)

Poor indexing and big instances.

It all began with the creation of a basic atlas instance. So, you've got your database set up, the searches are lightning quick, and the number of tables and entries per table is small. Everything is in good working order.

The number of records is increasing, things start slowing down. For example lets just say you're using mongodb and are using a service provider like atlas, you can go ahead and boost the compute and increase the instance teir. Bill is soaring, queries are being resolved  at a reasonable pace.

The number of records has increased by a large margin even further, and your bill is going over the roof. Now the research and development begins and you're looking for ways to improve things. Everyone is talking about indexes at this phase, so you study up on them and then start creating index one by one.

Your first index, say you have a list of users and you are querying top 10 emails sorted alphabetically, you create an index of emails. You make your first query, damn that was fast, super dooper fast. Now you are confused, damn I wish I knew this earlier. You start creating simple index, compound index and everything is blazing fast.

Now you look at the bill, its still the same, you realize I don't need this powerful config/compute for simple project and bring down your instance sizes and things are still fast. You saved some money by improving queries.

Now that you have found your motivation to optimize things and bring down costs, you look at further optimization.

Part 2 : Data transfer, the mother of all costs.

Subscribe to Bharath M Shetty

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.