I enabled pg_stat_statements on an AWS RDS postgres 9.6.3 instance with 30GB RAM.
We got the error message below in postgres log, and an event saying OS killed DB server process due to excessive memory consumption.
UTC::@:[32358]:LOG: server process (PID 9689) was terminated by signal 9: Killed"
We opened a case with AWS and they said server is too small for the load and to increase server size, we increase to a larger server with 64GB but after few hours (took slightly longer than last time) here also the DB went into recovery as OS killed DB process.
Disabling pg_stat_statements fixes the issue, we saw the same issue in other RDS instances also.
It seems there is some memory leak with pg_stat_statements as based on our setting below this extension should not use more than 100MB of RAM.
1. pg_stat_statements.max=100000
2. pg_stat_statements.save=1
3. pg_stat_statements.track_utility=1
4. Create extension from psql command line utility.
5. shared_preload_libraries=pg_stat_statements
Any ideas how to fix this, as we want to use pg_stat_statements to look at DB performance.
Also is there an Oracle AWR equivalent on postgres.
pg_stat_statements.max=100000
lower this setting to 1000 and try