Binary vs text based database?

Hello,
I am deciding a database for a small project. I was wondering if I choose a binary type over text base (pure JavaScript + Json text). I’m also looking at embedable databases, meaning they would be coupled with the files of my front end. Such a database would be NeDB or lowdb. The reason is because I’m only requiring a basic NoSQL for my react front end. My only requirements are that I can make a restful api with it, noSQL, and that it’s fast. Looking forward to your opinions! Thank you!

If it’s a low traffic app with a fairly small db, then a json file would be fine.

So text based is slower? How much slower would you say?

I’m not sure what you mean. I am advocating for a simple .json file that you open and edit, which is fine for a few users at a time.

Binary is faster if you choose a DB that supports JSONB or something similar. I’m not familiar with the solutions you’re looking at. SQLite has JSON fields, which is what I would opt for in a medium traffic situation. https://www.sqlite.org/json1.html

It’s normally a mistake to focus on pure speed. Best practice is to make the code easy to write and debug, and measure performance afterwards. That way, you have actual metrics to determine where the most benefit can be gained,

3 Likes

It depends on what you need to do. JSON might seem the best because it is simple, including simple to use. But then you might need to add features that a database already has. And then more features. And then more. And by then you have invested so much into your choice that you are reluctant to change. So you continue re-inventing features that would have been easy to have if you had chosen a real database in the beginning.

That is a typical beginner mistake. So go ahead, choose JSON files. The worst that can happen is that you learn a lot.

3 Likes

Cool. So when I start adding more features I’ll remember you advice and switch to something like MongoDB. I know they have a feature to transfer over JSON files to their db

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.