VACUUMLO(1)

πŸ’– VACUUMLO(1) β€” the manual page, but make it a group chat πŸ’–

okay bestie, so this is the vacuumlo page from the PostgreSQL 18.6 docs. it's short, it's iconic, and it's about yeeting orphaned large objects out of your database. let's get into it 🫢


✨ NAME ✨

vacuumlo β€” remove orphaned large objects from a PostgreSQL database πŸ§ΉπŸ’…


✨ SYNOPSIS ✨

vacuumlo [option...] dbname...

that's it. that's the whole vibe. options first, then one or more database names, no cap.


🌸 DESCRIPTION 🌸

so vacuumlo is a simple little utility program, and what it does is remove any "orphaned" large objects from a PostgreSQL database. and what's an orphaned large object (LO), you ask? it's literally any LO whose OID does not appear in any oid or lo data column of the database. like, nobody's holding its hand anymore. it's free-floating. it's giving abandoned. and vacuumlo is the friend that goes "okay we're cleaning this up" 🧚

if you use this, you may also be interested in the lo_manage trigger in the lo module. lo_manage is useful to try to avoid creating orphaned LOs in the first place. prevention queen πŸ‘‘

All databases named on the command line are processed. all of them. every single one. no skipping πŸŽ€


πŸ’… OPTIONS πŸ’…

vacuumlo accepts the following command-line arguments:

  • -l limit, --limit=limit β€” Remove no more than limit large objects per transaction (default 1000). Since the server acquires a lock per LO removed, removing too many LOs in one transaction risks exceeding max_locks_per_transaction. Set the limit to zero if you want all removals done in a single transaction. 🚨
  • -n, --dry-run β€” Don't remove anything, just show what would be done. a little preview, a little dress rehearsal, no actual deleting πŸ’­
  • -v, --verbose β€” Write a lot of progress messages. she's chatty and we love that πŸ“£
  • -V, --version β€” Print the vacuumlo version and exit.
  • -?, --help β€” Show help about vacuumlo command line arguments, and exit.

vacuumlo also accepts the following command-line arguments for connection parameters:

  • -h host, --host=host β€” Database server's host.
  • -p port, --port=port β€” Database server's port.
  • -U username, --username=username β€” User name to connect as.
  • -w, --no-password β€” Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. (bestie is running unattended, she cannot be asked for secrets πŸ™ˆ)
  • -W, --password β€” Force vacuumlo to prompt for a password before connecting to a database.
    • This option is never essential, since vacuumlo will automatically prompt for a password if the server demands password authentication. However, vacuumlo will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.

🌈 ENVIRONMENT 🌈

  • PGHOST
  • PGPORT
  • PGUSER

Default connection parameters. yes, just those three, all lowercase, all vibes.

This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.15). πŸ“š

The environment variable PG_COLOR specifies whether to use color in diagnostic messages. Possible values are always, auto and never. slay, even your errors can be pretty 🎨✨


πŸ” NOTES πŸ”

okay so here's the tea on how vacuumlo actually works β€” it's genuinely so clever:

  1. First, vacuumlo builds a temporary table which contains all of the OIDs of the large objects in the selected database.
  2. It then scans through all columns in the database that are of type oid or lo, and removes matching entries from the temporary table.
  3. The remaining entries in the temporary table identify orphaned LOs. These are removed. πŸ—‘οΈβœ¨
⚠️ Note: Only types with these names are considered; in particular, domains over them are not considered. so if you made a fancy domain type on top of oid or lo, she does NOT see it. she said "i only know oid and lo, i don't know her" πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

Peter Mount <peter@retep.org.uk> β€” the original main character, we thank her for her service πŸ«‘πŸ’–


PostgreSQL 18.6 Β· 2026 β€” that's the source and the date, bestie, and that's a wrap. go forth and de-orphan responsibly πŸŒΈπŸ¦‹πŸ’œ