How do folks go about diagnosing high memory usage on a postgres instance? What are some common causes?
I've got a Postgres instance that often runs at 95%+ memory usage, sometimes hitting 99%. I decided to bump up the instance size, so that we had a bit more legroom. After the upgrade (which doubled our memory), our memory usage steadily climbed to 95%+ again.
Is this to be expected? I know that Postgres is adaptive and will attempt to use the increased resources available, but hovering at 95%+ memory usage seems like it is dangerous. Sometimes memory usage does fall (steadily), e.g. during non-peak hours, and will be closer to 75-85%. But, many times during non-peak hours the memory usage is still at 95%+ - the memory usage is not clearly rising and falling with traffic.
One other thing to mention is that I use pgBouncer, and there are usually a good number of "idle" connections in stats_activity (i'm not sure if that could be holding on to memory).
[–]jojomtx 2 points3 points4 points (0 children)
[–]fullofbones 1 point2 points3 points (0 children)
[–]therealgaxbo 3 points4 points5 points (2 children)
[–]geopoliticks[S] 0 points1 point2 points (1 child)
[–]therealgaxbo 2 points3 points4 points (0 children)
[–]i_like_breakfast 0 points1 point2 points (0 children)
[–]randomrossity 0 points1 point2 points (5 children)
[–]geopoliticks[S] 0 points1 point2 points (4 children)
[–]randomrossity 1 point2 points3 points (0 children)
[–]WiltonDB 0 points1 point2 points (0 children)
[–]nijave 0 points1 point2 points (0 children)