Exponential Postgres Memory Usage?
Wanted to ask a quick question about Postgres plugins and memory usage. Over the past 23 days I've noticed memory usage increase almost exponentially. During that time, my application has had a very steady usage of about 65MB of memory usage (the project has the application & database only).
Now my use case for Postgres is very specific.....every hour a few hundred (between 300-600) rows of data are added to a single table in Postgres.
My gut is telling me that Postgres is simply keeping the 'newer' data available in memory hence the growth in memory. Can I assume that memory is uncapped in the Postgres plugin? If I'm right, is there anyway to cap it? or rebaseline the memory, would a restart of the database help for instance?
Solution:Jump to solution
databases get the same resources that your plan does 8vcpu and 8gb ram, and there's no way to cap it, you can restart to rebase the memory usage but that's only a temp fix because this would just happen again in the next 23 days
14 Replies
Project ID:
451fa1d0-fb81-42a8-a304-63d1fec478cb
451fa1d0-fb81-42a8-a304-63d1fec478cb
I'm not sure if I'd trust the graph in the usage page, what does the plugin's metrics say about memory usage?
Thanks for quick reply. Sadly it was telling the same story
Solution
databases get the same resources that your plan does 8vcpu and 8gb ram, and there's no way to cap it, you can restart to rebase the memory usage but that's only a temp fix because this would just happen again in the next 23 days
and you can't modify the postgres config file of the provided plugin to maybe change what postgres keeps in memory
Ok brilliant thank you for the confirmation. My use case is quite unique. Its more akin to a no-SQL DB but sadly I do need the relational aspects as well. I'll do a restart for now and work on a solution
I see two options, switch to a neon.tech database, or wait until databases become just a service and a volume so that you'd be able to tweak the database config to your hearts content
I actually tried Neon but the coldstarts were an absolute killer
ah right, then maybe the postgres hosting from vultr or digital ocean?
Its cool, id rather spend money with Railway π (I actually migrated from DO to Railway) I'll have a go at my own custom Postgres docker image where I can limit memory & settings etc.
Thanks for the suggestions though, really helpful!
you could totally run your own custom postgres database, but there are some limitations to the current system that make it a little less than ideal
like you'd only be able to access the database through the internal private network because railway doesn't support tcp proxying... yet
I'm fine with that restriction actually but thanks for the heads up! Also....restart did rebase the memory so thanks again for that confirmation
no problems! π