A database stores data in a two-dimensional table of rows and columns, but is stored in a one-dimensional string, such as one of the following tables:
EmpId |
Lastname |
Firstname |
Salary |
1 |
Smith |
Joe |
40000 |
2 |
Jones |
Mary |
50000 |
3 |
Johnson |
Cathy |
44000 |
This simple table includes the employee code (EMPID), the Name field (Lastname and Firstname), and the salary (Salary).
This table is stored in the computer's memory (RAM) and storage (hard disk). Although the memory and the hard disk are different in mechanism, the computer's operating system is stored in the same way. The database must store the two-dimensional table in a series of one-dimensional "bytes" that are written by the operating system to memory or hard disk.
A row database stores data values in a row together, then stores the next row of data, and so on.
1,smith,joe,40000; 2,jones,mary,50000; 3,johnson,cathy,44000;
A column database stores the data values in a column together , then stores the next column of data, and so on.
; Smith,jones,johnson; Joe,mary,cathy; 40000,50000,44000;
This is just a simplified statement.
In the field of relational database, in addition to the traditional database of Oracle, SQL Server and MySQL, the database of data warehouse is becoming more and more concerned.
Two-contrast1 rows are more suitable for OLTP, querying all columns of a record. columns are more suitable for OLAP, and are ideal for use in data warehousing, such as data analysis, mass storage, and business intelligence , involving infrequently updated numbers . because of the different design, the column database has advantages in parallel query processing and compression. And the data is listed as cell storage, regardless of the data modeling or modeling is simpler. To query the data on which columns are computed, directly read the columns on the row.
2 column in the storage area occupies a great advantage, can effectively improve the data compression ratio, save storage space.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
What is a row-type database and what is a column database