Database recommendation for my use case

For my work I need to have a API where I can process data and save them for later usage, for example to return saved result if the request data is same.
Btw, I plan to use https://rocket.rs since it looks simpler to use than alternatives, but I don't think it matter for the case.
In my case, an user sends data, I process this data and return the processed data.
Most likely the processed data will be in json format.
So, my plan is to get a hash (sha256 or simpler one) and have this as a folder where I put all analysis from the data, there will be subfolders as well to specify concrete analysis result, for example based on epoch and these sub-folders will contain json data a.k.a. the processed data. (the processed data may differ time to time so I need to have a way to differentiate them)
This is a structure I imagine for my project but not sure which database should I use to get similar structure.

my_db:
  -- 196b0f14eba66e10fba74dbf9e99c22f // file hash
     --1635252222  // analysis time / id
        --json_data // actual data
     --1635255525
        --json_data
  -- b95166980a3c526fddc54bb44a84e0fc
     --1633344525
        --json_data
  -- d7ad85048dad5ef47f8f7f6ab6b9885e
  ...

Any recommendation which db should I use and how to approach the problem from rust side?
Fast lookup is more important than fast saving/writing, for example fast index lookup by hash would be really good.

I don't have experience in maintaining databases, so simpler is better

In most cases, I use PostgreSQL as database, but it might be overkill in your case (and I have no experience with Rust interfaces for PostgreSQL yet).

I use PostgreSQL because it is a pretty powerful database. I have experimented with NoSQL too, but wasn't happy in the end. Arguably, SQL is a bit dated, but it allows to express complex queries. PostgreSQL also supports many options for indexing, including partial indices, indices on function output, etc. as well as replication.

1 Like

I recently started to use SQLite3 for web app backends during at least the early stages of development. It simplifies getting started so much, since it doesn't require a separate server and is zero-config. You'd be surprised how much you can do with it, both in terms of features and performance.

Yeah, SQL is ugly, but in my experience, it's still the most advanced and mature query language.

1 Like

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.