The difference between database rows and columns of storage of storage

Here the distinction between brief conceptual database rows and columns of storage and storage thereof.

Line storage

Traditional relational database, according to the line memory (two-dimensional table) data, as shown below:

Of these, only one row seating to fill up, John Doe king five Zhao six are not filled. Because this structure is fixed rows, each row in the same, even if you do not, it must be empty to go, but can not do without.

Columnar storage

In order to make the distinction between a conventional database, the new database is called a non-relational database to store the data in columns, as shown below:

John's original one (cells) corresponding to a data row of data Joe Smith now, the original data corresponding to the seating of the six seating now six rows of data. The original data is six in a row, so that a common primary key (i.e., John Doe). Now turned into six rows, each row of data requires a primary key (or do not know who this line of data), so the original primary key (that is uniquely identifies John's) repeated six times.

Since the original column into the current line, there is a need to add a line, you did not need to add, so as not to cause waste of space.

And storing the difference between the line of the storage columns

1. The fixing structure tends line storage, it tends to weaken the column storage structure.

2. The line of data stored in the storage line requires only a primary key, a line of data stored in storage columns requires multiple primary key.

3. columnar storage business data are stored, and columnar storage in addition to business data, but also need to store column names.

4. line store is more like a Java Bean, all fields are well defined in advance, can not be changed; columnar storage is more like a Map, not defined in advance, freely entered, and add key / value.

 

"The story of youth, always sunny weather, beginning with the most cheerful tone. Like, storyteller, really do not know how sad ending like."

Guess you like

Origin www.cnblogs.com/yanggb/p/11179056.html