What is

PostgresDB 53200: Out of memory

 ?
  1. Check current memory usage:
  2. SELECT pg_size_pretty(pg_database_size(current_database())) AS db_size;
  3. Identify large objects consuming space:
  4. SELECT nspname || '.' || relname AS "relation",
    pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
    FROM pg_class C
    LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
    WHERE nspname NOT IN ('pg_catalog', 'information_schema')
    ORDER BY pg_total_relation_size(C.oid) DESC
    LIMIT 10;
  5. Check long-running queries that might be locking resources:
  6. SELECT pid, now() - pg_stat_activity.query_start AS duration, query, state
    FROM pg_stat_activity
    WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'
    AND state != 'idle'
    ORDER BY duration DESC;
  7. Terminate long-running queries if necessary:
  8. SELECT pg_cancel_backend(pid);
  9. If the issue persists, consider increasing the memory available to PostgreSQL:
    • Temporarily increase the work_mem setting for the current session:
    • SET work_mem = '256MB';
    • For a more permanent solution, modify postgresql.conf and restart the database:
      • Find the file location:
      • SHOW config_file;
      • Edit postgresql.conf, increase work_mem and/or shared_buffers, then restart PostgreSQL.
AWS CloudWatch
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Master 

PostgresDB

 debugging in Minutes

— Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

PostgresDB

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Deep Sea Tech Inc. — Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid