The Initial Touch on Database and Look on Documented Database 


After selecting a suitable programming language and programming environment for your application, it is your time to decide some kind of suitable database for implementing the data of your application. 

We can take the database as a structured system for collecting, retrieving and displaying information. It includes records for each entry, and fields within each record to define information which may be useful for automating and simplifying many business functions. 

Many databases are based on SQL, or Structured Query Language, which is a programming language used to create relational databases. The size and complexity of the database program you choose depends on your present and future needs. 

In here there are so many things to consider when you are choosing a suitable database for your application, there are so many relational and NoSQL databases available for your application, first of all you have to determine what are the performances of your database that you need within your application after you create the application successfully,  you have to select a database by fulfilling all those needs for your software and the parties who are using your application. Here I must mention that there is no use of using the technology you are familiar with rather than using  the most appropriate one for your project.

When choosing a database different people have used to consider different criteria of aspects of databases in order to make their works more easier. Here we must consider the purchasing costs, the amount of storage that we're going to store on it,  what are the network requirements and what are the available resources  for our database because practicality is one of the most important things when we create an application.

when I take the things that we need to  consider at select in the database together, 

one of the main thing that we have to consider on this is operational and maintenance costs of the database:

  • A reliable monitoring and alerting system
  • Support for backup and restore
  • Reasonable upgrade and migration costs
  • An active support community
  • Ease of performance tuning
  • Ease of troubleshooting

As the next step we have to consider about Service stability of the database that we are going to use:(In here, it is better to consider about the persons and organizations  we are going to use our application and our database for them)

  • Support for multiple data replicas
  • Highly available services
  • Support for multiple writes and multi-active architecture

And also we need to have an idea about the performance and the uses and the implementers  of our  Software application may satisfy with those performance.

  • Latency
  • Queries per second (QPS)
  • Whether it supports more advanced hierarchical storage features

we need to have an idea about some of the following things in order to make a good intimacy with our database regularly,

  • Stable services
  • Performance
  • Scalability(, multiple users will need access to the database at the same time, so the database should support multiple users. Even if you start with a single user, plan for growth of your organization, and expect others to need access to data.)
  • Ease of developing database interface
  • Ease of modifying the database schema

There are 2 main types of databases:

• Relational Databases (SQL based).

• NoSQL Databases.


 

  • X-axis, application scenarios
  • Y-axis, database interfaces

Databases support OLTP workloads and the SQL language.
NoSQL databases - for optimizing special scenarios.

 

Then we have to find out whether we need a non-relational database or relational database for our application. Most database platforms are relational databases that use structure or schema, based on tables and fields that relate to each other and include common elements. Non-relational databases are useful for capturing values from non-standard elements like web content, emails and documents.

Relational Database

Simple structure, use SQL, (for data, normally in a program.),fast updating, All the DB is saved on one machine, and relations between records are used as pointers,(update a record once and all its related records will update immediately.),supports automatic transactions As the disadvantages of relational DB, we can see, query execution time can be increased with the size of the table, doesn’t support OOP based objects.

Document Database

Keep objects with different structures, can represent almost all the data structures including OOP based objects, lists, and dictionaries using good old JSON. Unschematized by nature, it often supports schema validation, meaning you can make a collection schematized, the schema won’t be as simple as a table, it will be a JSON schema with specific fields.

Querying is very fast, query time is independent of the DB’s size and supports parallelly. scaling the DB is done by adding more machines and distributing your data between them, this method is called ‘Horizontal Scaling’. This allows us to automatically add resources to our DB when needed without causing any downtime.

As the disadvantages of Documented Database, Updating the data is a slow process in Document DB since the data can be divided between machines and can be duplicated. Atomic transactions are not inherently supported.

Some suggestions for using a DBs -
  • cache — key-value DB.
  • graph-like data — graph DB.
  • If you tend to query on subsets of columns /features — use column DB.
  • For all other use cases — Relational or Document DB.


I am going to focus on the NoSQL database from this article. There also we have multiple choices, let’s see how to select the correct NoSQL database for our developing application.

When we choose a NoSQL database, there are also some points to consider, such as to use the primary-secondary framework, client shading, distributed cluster, Couchbase, or HiKV.



Efficiently choosing a NoSQL database

While in relational DBs everything is structured to rows and columns, in NoSQL DBs there is no common structured schema for all records like relational databases are maintaining rows and columns for storing data. 
Most of the NoSQL databases contain - JSON records. Also different records can include different fields.
The exact meaning of this is, Not mainly SQL”. (But many NoSQL DBs support querying using SQL )

Unit of this DB - document.
Document is a JSON.

Schema can vary between different documents and contain different fields.

Allow indexing of some fields in doc - allow faster queries based on those fields (*this forces all the documents to have the field if you use this feature).

Also supporting parallel computations.

Mainly used for -
  • Data analysis - Cause different records are not dependent on one another.
  • big data analytics

Common document-based databases: MongoDB, CouchDB, DocumentDB.

NoSQL database Selection

Efficiently choosing a NoSQL database

NoSQL DBs

There are 4 main types of NoSQL databases:

1. Document-oriented DBs
Document-Oriented

 2. Columnar DBs
Column DB
Unit of this DB - column in the table, (meaning the data is stored column by column.)
It can convert column-based queries very efficiently, (since the data on each column is quite homogeneous- this allows better compression of the data.)
Use - tend to query on a subset of columns in your data(no need to be the same sub-set)
Columnar DB only needs to read these specific columns ( row-based DB would have to read the entire data).

Common column DB database Example: Cassandra.

3. Key-value DBs
Key Value DB

The Key-Value database  is very fast.(Because of the use of unique keys, most of the key-values store the data in memory (RAM) which allows quick access.)
More expensive than other kinds of databases 
Use -used for cache since it is very fast and doesn’t require complex querying, also the TTL feature comes very useful for caching, fast querying and meets the key-value format.

Common key-value databases: Redis, Memcached


4. Graph DBs
Graph DB Example

MongoDB



Today we are focusing on some initial steps to create simple data operations with MongoDB and what it is. 

MongoDB is a document database designed for ease of development and scaling. The Manual introduces key concepts in MongoDB, presents the query language, and provides operational and administrative considerations and procedures as well as a comprehensive reference section.(MongoDB- official Doc.)

MongoDB offers - 

  • Community , (Free Source)
  • Enterprise( part of the MongoDB Enterprise Advanced subscription and includes comprehensive support for MongoDB deployment.) versions DB, features -  LDAP and Kerberos support, on-disk encryption, and auditing
  • A record in MongoDB - document (which is a data structure composed of field and value pairs.)
  • MongoDB documents are similar to JSON objects.
  • The values of fields - arrays, and arrays of documents.

The advantages of using documents are :-(from, MongoDB- official Doc.)

  • Documents (i.e. objects) correspond to native data types in many programming languages.
  • Embedded documents and arrays reduce the need for expensive joins.
  • Dynamic schema supports fluent polymorphism.

 

Let’s see how to include some records to the database at mongo DB,


(Please Use Request Form if some issue occurred with accessing the Git Account Repository)


(*Scalability: Whether it's easy to scale horizontally and vertically)

(*Security: Whether it meets audit requirements and prevents SQL)

Comments

Popular posts from this blog