What is blob?
A blob (Binary Large OBject) is a way to store a big chunk of raw data-like images, videos, audio files, or any other binary content-inside a database or a file system without caring about its internal structure.
Let's break it down
- Binary means the data is stored as a series of 0s and 1s, just like any computer file.
- Large indicates that the size can be anything from a few kilobytes to many gigabytes.
- Object tells you it’s treated as a single item, even though it may contain many bytes.
Why does it matter?
Blobs let developers keep large, unstructured files together with related data (like user info) in one place, simplifying backup, security, and data management. They also avoid the need to create separate storage systems for each file type.
Where is it used?
- Relational databases (e.g., MySQL, PostgreSQL, SQL Server) for storing pictures, PDFs, or video clips.
- Cloud storage services that expose a “blob” API, such as Azure Blob Storage or Amazon S3.
- Content‑management systems, email attachments, and mobile apps that cache media locally.
Good things about it
- Simplicity: Treats any file as a single value, easy to insert, retrieve, and delete.
- Atomicity: The whole file is saved or rolled back as one unit, keeping data consistent.
- Security: Can use the same access controls as the surrounding database or storage service.
- Portability: Works across many platforms and programming languages.
Not-so-good things
- Performance: Large blobs can slow down database queries, especially if the database isn’t tuned for them.
- Backup size: Including big files in database backups makes them larger and slower to restore.
- Limited querying: You can’t search inside a blob’s contents without extra processing.
- Potential cost: Storing massive amounts of binary data in a traditional DB can be more expensive than using dedicated object storage.