a month ago
I have a trouble understanding the ram usage on my postgres database instance.
Technically it should use significantly less than what it is using now. My suspicion is your garbage handler is not working properly and costing users a lot.
If I have a 3 gb database, it shouldn't keep using 3 gb of memory, it is potgres should be at max 100mb.
Can someone please look into that, and if it gets fixed, I would like some re-imbursement for my extra costing, since I tried everything else to fix it.
5 Replies
a month ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
a month ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • about 1 month ago
a month ago
Hey there!
My guess would be that you have many open client connections. By default, Postgres allows up to 100 concurrent connections. If all of them are active at once (and you’re not using a connection pooler), Postgres can easily use 1 GB+ of memory, since each connection consumes its own memory for query execution.
I suggest putting a connection pooler in front of Postgres (like PgBouncer) or lowering your client’s pool size.
If you’re using an ORM, most of them document how to configure their connection pools as well.
If you choose the pooler route, I posted a guide in another post:
https://station.railway.com/questions/need-guidance-adding-pg-bouncer-to-exist-4e29f0c1#7t8c
crisog
Hey there!My guess would be that you have many open client connections. By default, Postgres allows up to 100 concurrent connections. If all of them are active at once (and you’re not using a connection pooler), Postgres can easily use 1 GB+ of memory, since each connection consumes its own memory for query execution.I suggest putting a connection pooler in front of Postgres (like PgBouncer) or lowering your client’s pool size.If you’re using an ORM, most of them document how to configure their connection pools as well.If you choose the pooler route, I posted a guide in another post:https://station.railway.com/questions/need-guidance-adding-pg-bouncer-to-exist-4e29f0c1#7t8c
a month ago
It's neither of those problems
I checked active connections, there are barely any. 1, 2 at most
you don't need a bouncer to limit connection, you can do that from code. and that didn't help either (since the connections are already low)
lakshay-13
It's neither of those problemsI checked active connections, there are barely any. 1, 2 at mostyou don't need a bouncer to limit connection, you can do that from code. and that didn't help either (since the connections are already low)
a month ago
I know I'm asking a lot, just trying to help 
If downtime is acceptable, have you tried restarting Postgres? Does the memory usage drop after a restart, and then grow again later? What does memory usage look like right after startup?
Also, do you have any Postgres extensions installed?
crisog
I know I'm asking a lot, just trying to helpIf downtime is acceptable, have you tried restarting Postgres? Does the memory usage drop after a restart, and then grow again later? What does memory usage look like right after startup?Also, do you have any Postgres extensions installed?
a month ago
