Shanghai Tengke Education Dameng Database Training Dry Goods Sharing Listed Table Used in Dameng Database

In Dameng database, there are many types of tables. Traditional ordinary tables and heap tables are all stored in rows. Row storage is stored in record units. Data pages store several complete records. However, with the development of big data, a large number of query-oriented analytical needs are born. Therefore, Dameng introduced the concept of HUGE watch. In the HUGE table, data is stored in units of columns, and all rows of data in each column are stored together. This can speed up the data query speed of a certain column, and at the same time, because the column data types are consistent, greater compression efficiency can be obtained. This article will take everyone to know and understand the HUGE table.

 

This article demonstrates the environment: DM Database Server x64 V7.1.6.48-Build(2018.03.01-89507)ENT

01

Planning the HTS table space

The storage of HUGE tables in the database is not in ordinary table spaces and data files, but in special HTS table spaces. Creating an HTS is actually creating an empty file directory. The tables in the directory will be stored in a mode-table-column hierarchy of directories. The schematic diagram is as follows:

By default, the HUGE table will be stored in the HMAIN tablespace that comes with the database. We can also manually plan an HTS table space named HTEST, the specific statement is as follows:

 

 

Pay attention to the difference between this and the ordinary tablespace. The ordinary tablespace must specify the path of the data file when planning, while the HTS tablespace specifies a directory. Planning the database will help us create this directory, but because the database has not been inserted yet, the directory is currently empty.

 

02

Create HUGE table

With the HTS table space, we can try to plan a HUGE table in HTEST, the relevant statement is as follows:

 

 

The statement is similar to the general table building statement. Similarly, we can also use ordinary SQL to manipulate table data.

 

After creating the table and inserting data, we can query the storage structure of the table in the file system

 

From here we can see that the complete structure consists of three levels of directories: the HTEST directory of the table space, the SCH150994945 mode of the corresponding mode and the TAB1279 directory of the corresponding table. In the table directory, the data of each column will be stored in a separate dta file.

 

03

HUGE table instructions

The HUGE table is the same as the ordinary row table, which can be added, deleted, and modified, and the operation method is the same. However, the efficiency of the delete and update operations of the HUGE table will be lower than that of the row table, and the performance of concurrent operations will be worse than that of the row table. We can see this from the structure. If we want to insert a row of the database into the database, the dta file corresponding to each column will be modified. Therefore, frequent deletion and update operations should not be done in HUGE. In short, HUGE tables are more suitable for storage of analytical tables.

Guess you like

Origin blog.csdn.net/qq_42726883/article/details/108463815