N
Neon2y ago
correct-apricot

How is the storage size calculated?

As you can see in the screenshot: I have transferred 28 KB and the storage size became 29 MB. It seems to be a very inefficient way to store something.
No description
9 Replies
helpful-purple
helpful-purple2y ago
the storage size is your actual database size and the wal log. Data transfer is just the size of what gets transferred between your dabase and the connected clients
correct-apricot
correct-apricotOP2y ago
I would say the storage size can not be greater than the transfer size.
helpful-purple
helpful-purple2y ago
why do you think so? Storage size is what is on neons server ( all the data from your tables ) and the WAL log for the replication e.g whenever you do a insert or delete you can transfer more or less then whats stored on the server, if - e.g have alot of data and only query few times and just few rows and columns. - you query alot of data etc.
correct-apricot
correct-apricotOP2y ago
If I run SELECT pg_size_pretty(pg_database_size('mydb')); it returns '7440 kB'. My database has just one table with one row. I did just one insert. If the text you have quoted is correct the history of one insert is about 20 MB.
helpful-purple
helpful-purple2y ago
Are there any other databases in there? You could also set the History retention to 0 which should get rid of the WAL storage size
relaxed-coral
relaxed-coral2y ago
Hey @ceving, I do not think that 1 record is occupying such storage. I went ahead and inserted 20K rows but the size is still limited to 7536 KB.
quickest-silver
quickest-silver2y ago
@ceving take a look here in the documentation: https://neon.tech/docs/introduction/usage-metrics#storage-details Your database is 7KB, but Postgres has other metadata to store. Also, Neon retains a history of all INSERT/UPDATE/DELETE operations (known as WAL) to support instant point in time restore. If you want, you can disable this feature to reduce your storage usage.
Neon
Usage metrics - Neon Docs
This topic describes Storage, Compute, and Project usage metrics in detail so that you can better manage your plan allowances and extra usage. Storage In Neon, your storage is made up of the combined ...
quickest-silver
quickest-silver2y ago
A base Postgres container has ~21MB worth of databases, so what you're seeing is normal.
No description

Did you find this page helpful?