8 hours ago
I have a small database (~2GB, ~5M rows) that receives maybe one or two queries a second max. For some reason, it is gobbling up memory like crazy and I'm unsure what I can do to lower that usage, aside from limiting the node's RAM (which might OOM it).
I know that there is shared_memory and things like that to configure, but I can't really figure out how to do this in the Railway ecosystem.
Any help would be appreciated
Cheers!
Attachments
3 Replies
8 hours ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • about 8 hours ago
7 hours ago
Hola soy julio de amaiadigital
Probaste este método si la configuración inicial está mal. Puede ser que tenga problemas te paso algunas cosas para poder solucionar el problema y ver si podés manter sin que se te dispare la memoria y te tire error de memoria llena
7 hours ago
SELECT version();
SELECT name, setting, unit
FROM pg_settings
WHERE name IN (
'shared_buffers',
'work_mem',
'maintenance_work_mem',
'max_connections',
'hash_mem_multiplier'
);
SELECT
count(*) AS conexiones_totales,
count(*) FILTER (WHERE state = 'active') AS activas,
count(*) FILTER (WHERE state = 'idle') AS inactivas
FROM pg_stat_activity;5
Con esta configuración no te funciona vas atener que rever los puntos de configuración y arrancar con algo más si tenes 2gb es 512 Mb
Pero bueno espero que lo soluciones
4 hours ago
I forgot to mention, I'm using the standard https://github.com/railwayapp-templates/postgres-ssl/pkgs/container/postgres-ssl image provided by Railway without any modifications.
The commands you asked for returned the following btw
PostgreSQL 18.6 (Debian 18.6-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
hash_mem_multiplier 2 NULL
maintenance_work_mem 65536 kB
max_connections 500 NULL
shared_buffers 16384 8kB
work_mem 4096 kB
14 1 5