TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Storing Images in PostgreSQL vs. Object Storage for Large Datasets

16 pointsby atif089about 1 year ago
Is it advisable to store images directly in PostgreSQL for a dataset of 100 million records, each with a 200KB image, or should I use object storage with references from the start? My primary and only use case involves creating multimodal embeddings for search and relevance purposes.

3 comments

throwaway38375about 1 year ago
If you are storing 100 million images at 200KB each, that comes out at 20TB!<p>I would calculate the costs of something like S3 versus buying five 4TB HDDs and running a network file server.<p>You&#x27;re going to save a ton of money hosting this yourself. I would go with two used powerful desktop PCs. One as a DB server and the other as the file server.<p>Store the images on the file server and store the image&#x27;s path in the database server.
speedgooseabout 1 year ago
You could do quick tests using bytea, toast, or large objects.<p>But an object store may be more convenient overall.<p>When I did something similar, I did store embeddings and the image UUID in a table and my images in an object store with the same UUIDs as filenames. It was simpler to upload the images and put them available through a CDN.
reactorabout 1 year ago
Use something like SeaweedFS or Minio etc.