I'm working on a side project that involves a logging and notes app. I've implemented a feature that allows users to create backups of their data in JSON format, but I'm torn between two options for storage: using Postgres JSON fields or uploading to S3. The average user's backup might range from 1MB to 10MB, while power users could have backups as large as 50MB to 100MB. I have basic knowledge of Postgres, but I've never used S3. My concern is that if I choose Postgres, it could increase the load on the server due to user uploads and backup retrievals. On the flip side, using S3 would let me generate signed URLs for user uploads, making the process more efficient. I don't need to query the JSON backups, so I'm looking for some advice on which method would be more effective for my needs.
4 Answers
I recommend starting with Postgres for efficiency, especially since you already have the backend set up. But keep in mind that switching to S3 might be necessary as you scale. That could be a good future enhancement to consider!
For a small app, I think going with Postgres is a simple and effective choice at first. You probably won't face issues until your app really scales. If you reach that point, you can reevaluate and consider switching to S3 or another option like a document database.
If you don't need to query the JSON, S3 might be the way to go long-term. Databases can struggle with large files, and you've mentioned that your backups could take up quite a bit of storage. Using signed URLs for direct client uploads can ease the load on your server significantly, which could save on costs down the line too.
Yeah, exactly! Keeping the database free from those heavy loads seems smart, especially since those backups can add up!
You mentioned not needing to query the backups, so S3 actually sounds like the better option. It'll handle larger files better in the long run, and signed URLs will manage access efficiently. Just make sure you secure your S3 bucket appropriately!

Exactly! Starting with Postgres keeps things straightforward, and by the time you need to scale, you'll better understand your needs.