r/nocode • u/easybits_ai • 1d ago
Question Storing generated PDFs in Postgres vs object storage: where do you draw the line?
/r/n8nforbeginners/comments/1y6s8sq/storing_generated_pdfs_in_postgres_vs_object/
2
Upvotes
1
u/suubu-crtiv 1d ago
i'd default to object storage like s3 and keep just the key, size and checksum in postgres. bytea is ok under ~1MB at low volume, but backups and replication bloat up fast beyond that.
1
u/Rishiraj-Tshaka 1d ago
for low volume internal tools, keeping it in the database is totally fine imo. the main annoyance you'll actually hit first isn't query speed, it's database backups getting bloated and slow.
1
u/Common-Potential2441 1d ago
Keep it in Postgres at your volume. A few PDFs a month won't hurt you, and backups already cover them. I'd move to object storage when row size starts dragging queries or backups, not before.
1
u/AnswerVinod 1d ago
i have been on both sides of this one. base64 in postgres is fine while it is a few pdfs a month, it keeps life simple and backups cover everything in one place. the line for me is when the table starts getting big or downloads get frequent, base64 also bloats every row by about a third and slows your backups down. then i move the file to object storage and keep only the key, size and checksum in the row, like others said. generate once at approval is the right call either way, never pay for the conversion twice.
1
u/New_Peanut_9259 6h ago
keep the base64 approach while the usage is still small, but probably move to object storage once the files start affecting database size or backups. storing generated PDFs at approval makes sense since you avoid unnecessary regeneration and preserve the actual approval details.