PostgreSQL large objects: Best practices for Amazon Aurora and RDS
Database Blog
This article provides best practices for managing PostgreSQL large objects in Amazon Aurora and RDS, including monitoring orphaned objects, safely using vacuumlo, and preparing for major version upgrades.
- Large objects store binary data up to 4 TB and support partial reads/updates, but orphaned objects accumulate without autovacuum cleanup
- Monitor large object counts and sizes using system catalog queries to track growth and storage consumption
- Use vacuumlo in dry-run mode after running pre-flight schema checks to safely identify and remove orphaned objects
- Vacuumlo has limitations: it only detects oid and lo column types, missing domain types and integer/text columns storing OIDs
- Set up lo_manage triggers for automatic cleanup when large object references are updated or deleted
- Monitor OID exhaustion through Performance Insights LWLock:OidGenLock wait events to prevent creation slowdowns
- Before major version upgrades with high large object counts, run vacuumlo, VACUUM FREEZE, and scale up instance memory
Proper large object management prevents storage waste, OID contention, and upgrade failures by combining monitoring, safe cleanup practices, and preventive triggers.
The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.
Related articles
2026
2025
2026
2026
The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.