Score:0

Where is the advantage of a professional database (MySQL) over my system?

th flag

I have a website and I need to store data about customers, so I made the following system:

I made on my server a folder that I called database. In it I created a folder called customers. In this folder, I stored several JSON files, labeled by the ID of the customer. In the JSON files I stored the data of the customers.

Here is a small illustration, of the system:

database -> customers  ->  customer_14.json 
                          ->  customer_15.json
                          -> ...
                                         

I considered that the system is actually quite good, and it was also very easy to get this implemented. But when I showed it to my friend, he said that I should use MySQL instead of this system. He said mine was slow, unsecure and unreliable.

Now I wonder, where are the advantages of a professional database, like MySQL, over this system? Are there any at all?

Score:1
ar flag

First of all, there's many different databases out there. If you need to store JSON documents, a document database such as MongoDB may be a better choice than a relational database.

MySQL is a traditional SQL relational database.

If you have relational data, this is obviously a good thing; it makes it easy to describe relations and look up data.

If you, however, store JSON documents that bear no relation to any external data this doesn't really make sense - which is why we got document databases such as MongoDB.

Document databases can provide tools such as search, storage and indexing. This means that they will probably have better performance than your file system based implementation. In addition, they may be distributed, have redundancy options, locking, and other features which may or may not be relevant.

However, if you've implemented relational data in JSON documents - you're in for a world of hurt as your system grows. One of the aspects of normalization is to ensure that data is only present at one place, and not duplicated. This makes it easy to update and maintain records - something that is hard if the same piece of information is stored in a thousand different places - possible in different formats.

In short: if you have 5 documents and a single user, it doesn't really matter. But databases allow for scalability and a uniform access method over a network, making it easy to scale and share data between different applications.

There's no fixed answer to your question; it depends on how you use the data. But the average answer is that people use database systems because they makes things easier, not because they're stupid or love added complexity.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.