SQL / NoSQL

단단한어린이·2022년 4월 14일
0

Database

목록 보기
1/5
post-thumbnail

Structured Query Language(SQL) is a database language used primarily in relational databases. For example, you can use SQL syntax in various databases, such as MySQL, Oracle, SQLite, and PostgreSQL. SQL is a programming language for databases. You can send queries to the database to import or insert the data you want. And as can be inferred from the name, SQL can be leveraged in databases that use structured tables of data. Unlike databases where SQL is available, databases where the structure of data is not fixed are called NoSQL. Unlike relational databases, it stores data in different forms without using tables. Document-oriented databases such as MongoDB are NoSQL. In the database world, SQL is so important that it classifies SQL as a language. And in order to use SQL, the data must be structured.

Differences Between SQL Databases and NoSQL Databases

  • Storage
    NoSQL stores data in such ways as key-value, document, wide-column, and graph. Relational databases use SQL to store data in tables. The data must be stored in a prescribed format based on a pre-written schema.

  • Schema
    SQL requires a fixed format schema. In other words, you should predetermine information about the column for each data attribute you want to process. You can change the schema later, but you will need to modify the entire database or take it offline (down-time).
    NoSQL can dynamically manage the form of a schema rather than a relational database. When you add rows, you can immediately add new columns and do not necessarily enter data for all columns for individual properties.

  • Querying
    A query is to request information from the database. Relational databases must request data to match the format of the table and the relationship between the tables. So when you request information, you use a structured query language, such as SQL. Queries in non-relational databases focus on querying the data group itself. Therefore, data requests can also be made in unstructured query languages. It is sometimes referred to as Unstructured Query Language (UnQL).

  • Scalablity
    Typically, SQL-based relational databases expand vertically. The performance of the hardware on which the database is deployed is expensive. You can define database relationships across multiple servers, but they are very complex and time consuming.
    The NoSQL-based database expands horizontally. It's also known as cheaper server expansion, or expansion with cloud services. By deploying additional servers for NoSQL databases, you can handle a lot of traffic more conveniently. And it's relatively inexpensive to host NoSQL databases on low-cost general-purpose hardware or cloud-based instances, which are relatively less expensive than vertical scaling.

Cases that use SQL-based relational databases

  1. The ACID properties of the database must be adhered to
    ACID means Atomicity, Consistency, Isolation, Durability. Each word is a necessary property to ensure safety in the process of performing a state change by one transaction running on the database. SQL allows you to accurately define how databases interact, reducing the exceptional situations that can occur when processing data in a database and protecting the integrity of the database. Software development for all financial services, including e-commerce, must comply with the ACID properties of the database. So in this case, we typically use a relational database using SQL.

  2. The data in the software is structured and consistent
    When software (projects) are not large and consistent data is used, relational databases are often used. There is no reason to use a NoSQL database designed to support different data types and high traffic.

Cases that use NoSQL-based non-relational databases

  1. Store large amounts of data with little or no data structure
    Most NoSQL databases have no restrictions on the types of data that can be stored. You can add new types of data at any time, as needed. If software development requires a large amount of unstructured data, applying NoSQL may be more efficient.

  2. Get the most out of cloud computing and storage space
    Deploying cloud-based database repositories provides a low-cost solution. If the scalability of a database is important for software, it is recommended that you use a NoSQL database that can scale without difficulty.

  3. Frequent updates to the data structure during service deployment
    For NoSQL databases, you don't need to prepare a schema in advance, which is very beneficial to the rapid development process. This is the case when prototypes need to be brought to market quickly. In addition, if you need to update your data structure frequently without much downtime, it is better to use a NoSQL-based relational database than a relational database that requires each schema modification.


ACID

  • Atomicity defines all the elements that make up a complete database transaction.
  • Consistency defines the rules for maintaining data points in a correct state after a transaction.
  • Isolation keeps the effect of a transaction invisible to others until it is committed, to avoid confusion.
  • Durability ensures that data changes become permanent once the transaction is committed.
profile
Footprints in Coding

0개의 댓글