Learning objectives
After reading this article you will be able to:
- Understand what makes up a hosted database bill
- Estimate the size, RAM, and monthly cost of your database
- Spot the hidden costs of each pricing model
A cloud database is a database server (PostgreSQL, MySQL, MongoDB, or Redis) that runs at a provider, with disk and network, and that your application reaches through a connection string. The price is not a single number: it depends on how much memory the database uses, how much data it stores, and how the provider charges for each part.
Third-party prices change often, so this guide shows how the bill is built, not each provider's price list. Check the current figures on the provider's page before deciding.
What makes up the cost of a cloud database?#
Almost every bill splits into five items:
- Instance (RAM and CPU): the server itself, and usually the biggest item.
- Storage: the disk, billed per GB, sometimes with IOPS (operations per second) charged separately.
- Traffic: data leaving the database for outside the provider's network.
- Copies and snapshots: retention above the included quota is usually billed.
- High availability: replicas and failover multiply the instance cost.
Two databases with the same data size can cost very different amounts if one has a replica and the other does not.
What are the pricing models?#
Each provider picks a way to charge, and it changes how predictable your bill is:
- Fixed plan with quota: you pay a monthly amount and get RAM, disk, and traffic within limits. It is the easiest to predict.
- Hourly instance: you pick a size and pay for the hours it runs. To estimate a month, multiply the rate by 730, the approximate number of hours in a month.
- Usage-based: billing follows operations or storage consumed. It is cheap at low usage and hard to predict when usage swings.
How do some well-known providers charge?#
The same models show up in the best-known offers:
| Option | Model | What to watch |
|---|---|---|
| Supabase Free | no-cost tier | database size cap; inactive projects are paused |
| Supabase Pro | monthly plan with quota | disk included per project; overage billed per GB |
| MongoDB Atlas M0 | no-cost tier | small storage, meant for learning |
| MongoDB Atlas Flex | usage bands | the price rises with the operations-per-second band |
| MongoDB Atlas M10 (dedicated) | hourly instance | dedicated RAM, vCPUs, and disk; the hourly rate times 730 gives the month |
Current prices and limits: Supabase and MongoDB. On Amazon RDS, the instance is billed per hour, and storage, backup above the quota, and data transfer are separate items, as the RDS for PostgreSQL pricing page describes. Add everything up in the provider's calculator, because the instance price alone is misleading.
How do you estimate your database size and RAM?#
Measure what you already have. Each engine has a command:
-- PostgreSQL
SELECT pg_size_pretty(pg_database_size(current_database()));
-- MySQL
SELECT table_schema AS db,
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS mb
FROM information_schema.tables
GROUP BY table_schema;// MongoDB (mongosh): values in MB (dataSize, storageSize, indexSize)
db.stats(1024 * 1024)redis-cli INFO memory | grep used_memory_humanThen do the math: current size, plus monthly growth times the number of months, plus 30% headroom. A 2 GB database growing 300 MB a month reaches about 5.6 GB in a year (2 + 3.6) and, with headroom, needs about 7.3 GB of disk.
For RAM, the rule of thumb is that indexes and the most-used data should fit in memory. In Redis that is literal: the whole dataset lives in RAM, so used_memory sets the minimum instance size. The command is documented in Redis INFO.
What are the hidden costs?#
- Outbound traffic: serving data outside the provider's network can be billed per GB. Application and database in the same datacenter avoid this and cut latency.
- Pausing and quota overflow: no-cost tiers pause or block past the limit, and the next plan can be a big price jump.
- Duplicate environments: running separate staging and production doubles the bill.
- Copy retention: keeping more days of snapshots or backups uses disk. See how to back up a database.
- Future migration: leaving a provider with a proprietary format costs hours of work. Open engines like PostgreSQL and MySQL make leaving easier.
How do I cut the cost without losing reliability?#
Pick the right engine for the data: which database to choose keeps you from paying for a document cluster when a relational table would do. Use Redis only for what needs speed, not as primary storage. Remove old data with expiration routines and create only the indexes you need, since every index takes disk and RAM. Keep the application and database in the same region. For the steps to get a database online, read how to host a database.
How to do this on Square Cloud#
On Square Cloud, the items you added up above become the fixed price of a plan, billed in Brazilian reais. MongoDB, PostgreSQL, MySQL and Redis hosting starts on Standard, from R$44.99 a month with 4 GB of RAM; Hobby does not include databases. There is no charge for bandwidth or per request (fair use policy), and the database sits in the same datacenter as your applications, at about 1 ms average latency, so traffic between the two never shows up on the bill.
The RAM estimate you just made is the number that matters here. The plan's RAM is a pool shared by applications and databases: each database uses at least 512 MB (Redis) or 1024 MB (MongoDB, PostgreSQL and MySQL). A 512 MB web API with a 1024 MB PostgreSQL and a 512 MB Redis adds up to 2 GB and fits in the 4 GB Standard with room to spare. The number of databases is limited only by that RAM, with different engines side by side.
Copy retention is part of the plan too. Every plan that includes databases takes an automatic daily snapshot, kept for 7 days (the most recent for up to 30 days), and you take manual snapshots whenever you want, for example before a migration. A snapshot restores into the same database, another one of the same engine or a new database, or downloads as a .zip. Each database runs as a single node, without a replica: for critical data, also keep a copy of your own outside the platform.
You create the database in the dashboard (name, memory and engine) and it is ready in seconds, with mandatory TLS. See the databases available today on Databases, retention on Snapshots and the plans on Pricing.
Database hosting
MongoDB, PostgreSQL, MySQL and Redis next to your app
FAQs
Is there a cloud database at no cost?
There are no-cost tiers with limits, such as the ones on Supabase and MongoDB Atlas (M0). They suit learning and prototypes, but have a space cap and, in some cases, pause the project after inactivity. The limits change, so check each provider's page.
How much does a production database cost?
Entry-level paid plans, such as MongoDB Atlas Flex and Supabase Pro, cost far less than dedicated clusters, whose price grows with RAM, disk, and replicas. Prices change often: check each provider's pricing page and add disk, traffic, and copies.
Is a database from a big cloud provider more expensive?
It usually bills more items separately: instance, storage, IOPS, backup above the quota, and data transfer. The hourly instance price is only part of the bill.
How do I know how much space and RAM my database needs?
Measure the current size with a command from the database itself, project growth for the coming months, and add headroom. With Redis, the whole dataset has to fit in RAM.
More in Databases
See all 24 articles- What is Redis used for?Redis is an in-memory data store that keeps key-value pairs and rich data structures. Learn how it works, what it is used for and when not to use it.
- How to back up your databaseBack up MySQL, PostgreSQL and MongoDB with mysqldump, pg_dump and mongodump, then restore the dump. See the commands, how to verify and common mistakes.
- What is PostgreSQL?PostgreSQL is an open source relational database that uses SQL and guarantees ACID transactions. Learn how it works, what it is for and when to pick another one.
- How to choose a database for your projectFor most projects, PostgreSQL or MySQL is enough. See when to pick MongoDB, Redis or SQLite instead, with clear criteria and a recommendation per scenario.