A
A
Aryeh Leonid R.2021-10-17 17:23:31
Database
Aryeh Leonid R., 2021-10-17 17:23:31

What database to choose for the server on Node.js?

To an existing server (written in Node.js+Express.js) you need to add a new feature: a database.

  1. Access to DB Read Only. Those. after the server is put into operation, the DB does not change.
  2. Each entry contains about 200 bytes of binary data.
  3. Search for the desired entry by one ID.
  4. The DB has from one to two million records.
  5. Access speed is very important!


So what DB do you recommend?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Slava Rozhnev, 2021-10-17
@aryeh

Redis is an open source (BSD license) in-memory data structure store used as a database

M
Melkij, 2021-10-17
@melkij

Access to DB Read Only. Those. after the server is put into operation, the DB does not change.

Search for the desired entry by one ID.

When the application starts, load into the application's memory even from an ordinary csv or anything else.
Under these constraints, the external database is redundant.

R
Roman Mirilaczvili, 2021-10-17
@2ord

SQLite.
Why?
You can keep the entire database even on disk in one file, even in memory (in-memory).
Instead of your bicycle, write a SQL query or compose it with query builder / ORM and get an answer.
For speed - to expose the necessary indexes on the table.
CSV is a somewhat hardcore solution despite advice from some. If you need to change some data / structure in the future, you will have to change the entire file. And so it can change the table with one request.
Unlike Redis, you can keep data on disk as well, if needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question