Last week I visited an event for non-technical people covering the technical side of development. This is kind of event when a technical person is trying to put technical stuff in a nutshell for those who never wrote a line of code.
We were discussing databases and its importance for the project success. I understood that the database is a complex topic, but you have to be familiar with it to develop a good product. So, I will try to clarify what is a database, what kinds of storages are there, and which database suits which project. So, I will try to clarify what is a database, what kinds of storages are there, and which database suits which project.
What is a database?
First things first, the database is a collection of information (data) that can be stored, organised and accessed electronically. To put it simply, the database is an electronic card index built in any web application.
To understand what we are going to discuss in the next paragraphs, you have to know that the database can be relational and non-relational.
Relational database or SQL is when data resides in tables, where every row stores one piece of data and the columns are the same for each data set. All tables and attributes built the fixed schema of the database, so all entries have the same data types.
No relational or NoSQL is a data storage that have collections similar to SQL tables. They store all pieces of data like documents. The documents can have different attributes, so there is no fixed schema.
Our Top Databases: Pros and Cons
MongoDB is the most common no relational databases (NoSQL). Instead of using tables as in the SQL we use documents structured in BSON (a binary form for representing simple or complex data structures). Comparing to the SQL database we are not able to use joins but we can apply references to link documents.
The database ensures quick development since everything can be changed on the go. Also, MongoDB has built-in functionality that allows quick and flexible development. MongoDB is well-suited to MVP or a small application that has a low data volume and a handful of users. At the same time, it can deal with and scale larger datasets.
Using MongoDB makes spreading data out across commodity hardware on-site without extra software.
Quick and easy to make iterations on your schema
Comparing to SQL it’s more scalable and has better performance
Open-sourced with good tech support
MongoDB does not support joins, which results in increasing unnecessary usage of memory
The data size is up to 16 MB
You cannot perform nesting of documents for more than 100 levels
ElasticSearch is a real-time enterprise-grade full-text search and analytics tool. Enterprises like The Guardian, Netflix use it to power fast searches to support the data discovery applications. It’s designed to take data from any source and make it searchable. This is a technology that allows implementing the solution when you’ve got more data that you know what to do with.
Being a great search engine, ElasticSearch cares not only about the text but also numbers. Thus, companies use it as the add-on to other databases. ElasticSearch is quite flexible, it enables to change a configuration, index format or whatever you want to get it to scale.
It is the most powerful full-text search engine
Being a document-oriented database it can store complex data as structured JSON documents. Thus providing higher performance
The database supports REST API which is a light-weight protocol with a simple user interface
ElasticSearch does not support multi-language
It’s rather hard to learn and can be a challenging tool for developers with no relevant experience
MySQL is an open source relational database widely used in web application. Being a cross-platform it can work on multiple operating systems, including the most popular like Windows, Linux and MacOS. The database is easy and fast in installation and configuration. Thereby allowing developers to concentrate on the development and reduce costs and time to market.
The database is not the fanciest, but it has been around for a long time and gained a positive reputation. Large enterprises select MySQL because of its reliability and prominent community. Additionally, it is a popular choice as an embedded database, distributed by thousands of ISVs and OEMs.
Can support up to 50 million rows or more in a table
Open source enables to track how everything works under the hood
It enables to implement a variety of user interfaces
It’s a mature database. Thus, a solution to the most problems developers can find online
In the database, it takes a lot of time and effort to create incremental backups
The is no built-in support for XML or OLAP
Redis like MongoDB is an open-sourced non-relational database. In Redis, data resides in memory eliminating the need to access disks and reducing request time to microseconds. In contrast to databases that store data on disk, Redis can support more operations and ensure faster response times. Which makes it an ideal solution for Gaming, Financial Services, Healthcare, and IoT application
The database features different kinds of data structures, which simplifies building real-time apps. Redis is a fast datastore which enables millions of requests per second.
Redis is one of those databases geared toward specific use case for either session management for users or caching. Frequently developers choose Redis for a lightweight application like the small phone app.
Versatile data structures enable to meet any application needs
Faster performance and response times because of in-memory data residency
Redis comes with native data structures and enables to write fewer lines of code to manipulate and interact with data
In Redis, value queries will not perform without having a correct key
The size of the Redis datastore is limited to the size of the available memory
To move from SQL to Redis developer has to change of the actual application
Above we’ve covered five best databases we use in everyday development. There’s no such thing as the best database that will fit every case. A database is a tool you select according to the project needs. Everything depends on project size, number of users, developers background and your budget.
Check out our list of the best Java frameworks: https://sombrainc.com/top-java-frameworks-2019