Skip to content
scrambled
Software Engineering Flashcard

When should you use PostgreSQL Large Objects over bytea?

Concepts Deckdatabase Tags
  • database

Question

When should you use PostgreSQL Large Objects over bytea?

Answer

Only when files are very large and you need streaming/seeking (partial reads). Large Objects support up to 4 TB per entry and arbitrary byte-range access. The tradeoff: Different API (lo_create, lo_open, etc.), manual OID tracking, no refcounting (must call lo_unlink explicitly, orphans accumulate silently).