Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the traps of NoSQL database

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what are the traps of NoSQL database". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Schema management

Each NoSQL database handles the schema in its own way. In some cases there is no Schema (MongoDB), in some cases it is Elasticsearch, in some cases it is similar to Schema (Cassandra) in a relational database. In the conceptual model, data always has Schema. Entity, field, name, type, relationship. Regardless of the underlying type, the physical model is the representation of the conceptual model.

The NoSQL database gives us more freedom in terms of architecture. In MongoDB, we can add two different documents with the same field name but different types. Does it make sense? Instead of. Is this going to happen? Yes, of course. A simple human error can damage our application.

Another problem concerns the relationship between entities. Even if there are no relationships in the database, we must record the relationships between the data. From the relational database, we can generate ERD diagrams. If it is a NoSQL database, it may not be available.

When using NoSQL databases, we must keep in mind the issues related to schema management and data validation. Without it, the data could "explode". Interesting fact: some companies have replaced MongoDB with PostgreSQL.

Low error range

The performance of NoSQL databases is the result of proper data modeling, indexing and partitioning. In a relational database, we can add columns, convert tables, flip data from one table to another, and if we forget the index, we can add the index. For NoSQL databases, it is not feasible in all cases. We may need to use some external tools, such as Apache Spark, or even delete and recreate our data model.

In Elasticsearch, if we cannot get the schema / mapping of the index, we must use, for example, re-indexing API, which means we have to re-index the data to another index.

In Cassandra, we can only filter by pressing the partition key and the cluster key. If we forget to add a column to the key, it is possible to add an index, but if the cardinality of the collection is large, it will degrade performance.

ACID is not supported

The ACID attribute simplifies coding. We do not need to deal with errors related to the fact that the data in the X table already exists and the data in the Y table does not exist, if any. According to the CAP theorem, we know that there are consistent databases and ultimately consistent databases. The most popular database of this type is Apache Cassandra. The ultimate consistency requires different approaches to data modeling and application logic. You should write the code in a more defensive way, because you are not sure whether the record you just changed is available from another part of the application. HBase is an example of a consistent database, but even if Cloudera believes it will not replace a relational database. Some databases claim to be consistent and ensure consistency only to a certain extent. For example, MongoDB provides transactions, but multi-document transactions are only available since version 4. 0.

SQL is not supported

The disadvantage of NoSQL is the lack of SQL. We may or may not like it, but SQL is the basis of the data. Many analysts use SQL every day, and learning other languages may prevent them from using the database. There is a reason for creating Spark SQL or Beam SQL.

Limited analysis and / or no Join

This is just a discussion of the differences between OLTP and OLAP systems. We are used to using GROUP BY and JOIN clauses, but not every database provides such functionality. Due to the nature of the database, aggregation and merging can be very limited, if possible. For Apache Cassandra, the analysis function is usually achieved by grouping Apache Spark clusters together. You will learn how to connect with each other through my story.

This is the end of the content of "what are the traps of NoSQL database". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report