How do you split data between files in S3/R2 and a relational database?
Answer out loud or in your head first, then compare.
Answer
I usually keep a large document or a finished export in object storage. In the database I store its owner, status, version and a pointer to where the file is. That way I can use relations and transactions without putting the full contents of every file into a table.
Example: a job record says “document processed”, and the resulting PDF has a separate key in S3. You have to anticipate a failure between saving the file and the metadata, and have a way to find orphaned objects. A link granting temporary access is a permission: it shouldn't end up in public logs unnecessarily. Deleting a document has to account for its copies and derivatives.
Why it matters: A practical combination of storage, database and permissions.
Possible follow-ups: What if the file was saved but writing the database record failed?
How did it go? Be honest — “Not yet” puts the question on your review list.
Start with
- E-P01 · What is cloud computing? — AWS, Cloudflare and infrastructure
- E-P03 · What is Cloudflare, and what is it for? — AWS, Cloudflare and infrastructure
- E-P04 · How does Cloudflare differ from AWS? — AWS, Cloudflare and infrastructure
Further reading
- PostgreSQL: Transaction Isolation(opens in a new tab)Docs; accessed 22.10.2026. Isolation, locks and serialization anomalies; a good basis for working with an ORM.