Database designed for file storage

I am looking for any database designed for file storage.
Moreover, DB has to store the history of operations for example: "user created a new file", "user removed the file" etc.

I thought about:

  1. surrealdb (but it does not support for file storage).
  2. mongodb
  3. sqlite

It has to integrate with axum (async).

Any recommendations? :wink:

You might want to check out Minio, which is an AWS S3 compatible server:

I think it's versioning feature might satisfy your "history of operations" requirement, but I'm not 100% sure.

SQLite can notably be faster than the filesystem for storing files up to a certain (reasonable) size, and it's a well-established, battle-tested embedded DB. The rusqlite bindings are solid and maintained, although a little annoying to work with.

mongodb is a classical client-server DB. It probably scatters your "files" all over the place (in its own directory structure), so it will be annoying if you ever need a backup. Also, it's designed for storing documents – I'm not entirely sure how efficient it would be to store big blobs as a BSON binData object, but do note that parsing a BSON object needs to go through a couple of hops (due to how the data format itself is designed) in order to access subfields, and you can't store just blobs in MongoDB – every top-level member of a collection must be a document.

In addition, there's a hard-coded, per-document size limit of 16 MB in MongoDB, which is awfully small if you need to store "files". SQLite has a configurable limit on BLOB sizes, which is also much larger by default: 1 GB (109 bytes), but you can raise it to as much as 2 GiB (231-1 bytes).


Thanks for your reply.
I would like to try SQLite.
Does SQLite have a driver for async programming (
The rusqlite is not async. I have found tokio-rusqlite but is very young.

I don't know, but you can make rusqlite trivially async-friendly by using a multi-threaded runtime and something like tokio::spawn_blocking().

It's more than a year old and has 100'000 downloads. It's also #![forbid(unsafe_code)]. I don't think you need to have trust issues with it.

I believe sqlx suports it. If you want to use an orm SEAorm also suports it. All async.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.