The first NoSQL article

Source: Internet
Author: User
Tags value store

about a year ago I heard of NoSQL, surfing the internet to check, feel their foundation is poor, not to study these when (in fact, is lazy), now work two years, the foundation is still weak, think should assiduous learn something, so download the "NoSQL Getting started with databases.

Open a PDF, habitually look at how many pages of this book (Haha, or lazy, if good hundreds of page estimate and no confidence to see, but fortunately, only a page), so, first go to see it ~

First of all, read the introduction of this book, feel on a few questions:

1. Why NoSQL?

2. History of development;

3, the application of MEMCACHED\TOKYO\TYRANT\REDIS\MONGODB background, advantages and disadvantages, specific application examples and comparisons;

4. NoSQLthe mysql database .

the use of NoSQL:

1) Replace the relational database of weak processing (such as large amounts of data write processing, etc.);

2) as an alternative to the relational database (in the mind, if there is no merit, more than one choice is not necessary, this can be ignored).

Halo: This book actually said "... The operation is quite difficult, so this book simply locates NoSQL as a ' alternative to relational database ', alas! Suddenly feel a kind of can't say feeling! Just keep looking.

Here we go.

1. Basic knowledge of NoSQL databases1.1relational databases and NoSQL databases1.1.1What is NoSQL?

Oh oh,nosql! = No SQL NOSLQ = = Notonly SQL * * * * * * * * * * * * * * with a few stars! )

The meaning of it:

The application of relational database when the relational database, when not applicable to non-applicable relational database is not necessary, you can consider the application of more suitable data storage.

1.1.2history, classification and characteristics of relational databases

1) History (slightly)

2) category

According to the data Model (data Representation): class, Network, relational

class Type : Defined by a tree structure, simple, a parent record can have multiple child records, a child record only a unique parent record, it is difficult to express a complex relationship;

Network Type : It solves the disadvantage that hierarchical database is difficult to express complex relationship, but the common disadvantage is that it is impossible to make corresponding data access without understanding the structure, and if the relationship changes, the update is more difficult.

Relationship Type : Data and methods of Operation ( correlation between data ) separation, eliminate dependence on data structures, and apply a wide range of applications.

3) features

Advantage:

@1 Universal and high performance: The relational database performance is absolutely not low, it has very good versatility and very high performance, for the vast majority of applications it is the most effective solution.

@2 highlights the advantages of maintaining data consistency (transactional processing), complex queries such as joins, standardization - the cost of updating data is minimal, and there are many practical results and technical information.

Insufficient:

@1 Write processing of large amounts of data

In terms of data read-in, the master-slave mode generated by replication (the data is written by the primary database, the data is read from the database), it can be relatively simple to increase the scale from the database. However, in terms of data writing, it is not so simple. If you increase the primary database from one to two, you can actually reduce the load on each primary database, but the update processing will conflict or cause inconsistent data. In order to avoid this problem, it is not so easy to allocate requests for each table to the appropriate primary database for processing.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/49/4E/wKiom1QSwoOTg-UxAAEQBkA9MSI267.jpg "title=" 11.jpg "alt=" Wkiom1qswootg-uxaaeqbka9msi267.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/49/4F/wKioL1QSwqKwSPmgAAESD-kRHjA703.jpg "title=" 12.jpg "alt=" Wkiol1qswqkwspmgaaesd-krhja703.jpg "/>

In addition, we can also consider separating the database, reduce the hard disk I/O processing, realize the efficient processing of memory, the effect is very significant. However, the tables placed on different database servers are not able to join processing, the database segmentation needs to consider these issues in advance, otherwise it must be associated in the program, very difficult.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/49/4F/wKioL1QSwq7icrMWAAD0rJG_8_Y324.jpg "title=" 13.jpg "alt=" Wkiol1qswq7icrmwaad0rjg_8_y324.jpg "/>

@2 indexing or table structure changes for tables with data updates

In order to create an index or table structure change processing, you need to share the lock on the table, if time-consuming, you need to change the note: The data may not be updated for a long period of time.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/49/4F/wKioL1QSwrqSAEW1AACKpJjk2gU213.jpg "title=" 14.jpg "alt=" Wkiol1qswrqsaew1aackpjjk2gu213.jpg "/>

@3 field is not fixed when applied

Solutions for relational databases:

@1 need to add -- repeated pain

@2 Pre-set a large number of preliminary fields --it's too long to remember birds ~ Not recommended

@4 Processing of Quick return results for simple queries

This does not seem to be a disadvantage, but the SQL language needs to parse the SQL when it reads data , as well as the additional overhead of locking and unlocking the table, although not too slow, But the relational database is not good at quick return results for simple queries, so we want to handle simple queries quickly, no need to use relational database.

in this case, it is recommended that you use NoSQL database. But like MySQL provides a workaround that leverages Handlersocket , it's also possible. Although a relational database is used, there is no direct data access using SQL. Finally introduced Handlersocket.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/49/4F/wKioL1QSwsfACYTHAACVmKmbEyI282.jpg "title=" 15.jpg "alt=" Wkiol1qswsfacythaacvmkmbeyi282.jpg "/>

1.1.3 NoSQLDatabase

NoSQL databases are only used in specific areas and are largely non-complex, but they compensate for the shortcomings of relational databases.

    • Easy dispersion of data

relational database to JOIN as a precondition, usually have to store the data in the same server, which is not conducive to the dispersion of data. NoSQL databases, on the other hand, do not support JOIN processing, and each data is designed independently, and it is easy to spread the data across multiple servers, making it easier to process even large amounts of data for write operations. Similarly, the read-in operation of the data is equally easy.

    • Increase performance and increase scale

Aside: to make it easier for the server to handle a larger amount of data, there are only two choices: one is to improve performance, but to increase the size.

The most important thing to improve performance is to consider the cost, double the performance, the cost is often not just 2 times the original , it may take up to 5~10 times.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/49/4E/wKiom1QSwsGj7BW5AABLk6cx3rQ041.jpg "title=" 16.jpg "alt=" Wkiom1qswsgj7bw5aablk6cx3rq041.jpg "/>

Increase the scale, you need to change the program, the advantage is cheap, as long as the gourd to increase the number of low-cost server.

    • Is it not necessary to use large amounts of data for processing?

NoSQL databases are basically designed to "make it easier to write large amounts of data (making it easier to increase the number of servers)", but it has a variety of features.

@1 wants to seamlessly cache data

@2 expect high-speed processing of data of the array type

@3 want to save all

    • variety of NoSQL Database

There are various kinds of "key-value Store", "Document Database", "Columnstore database" in NoSQL database, and each kind of database contains its own characteristics.


This article from the "Growth Notes" blog, declined to reprint!

NoSQL First

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.