Help Center/ GaussDB(DWS)/ FAQs/ Database Usage/ How Do I Check Whether a Table Is Row-Stored or Column-Stored?
Updated on 2023-11-21 GMT+08:00

How Do I Check Whether a Table Is Row-Stored or Column-Stored?

The storage mode of a table is controlled by the ORIENTATION parameter in the table creation statement. row indicates row storage, and column indicates column storage.

In 8.1.2 and earlier versions, if ORIENTATION is not specified, row storage is used by default.

In versions later than 8.1.3, the default_orientation parameter can be used to control the storage mode. If the parameter ORIENTATION is not specified during table creation, the table storage mode is based on the value of default_orientation. row indicates a row-store table, column indicates a column-store table, and column enabledelta indicates that a column-store table with delta enabled is created. The GUC parameter can be configured on the GaussDB(DWS) console, as shown in the following figure.

You can use the table definition function PG_GET_TABLEDEF to check whether the created table is row-store or column-store.

For example, orientation=column indicates a column-store table.

Currently, you cannot run the ALTER TABLE statement to modify the parameter ORIENTATION.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
SELECT * FROM PG_GET_TABLEDEF('customer_t1');
                                  pg_get_tabledef                                  
-----------------------------------------------------------------------------------
 SET search_path = tpchobs;                                                       +
 CREATE  TABLE customer_t1 (                                                      +
         c_customer_sk integer,                                                   +
         c_customer_id character(5),                                              +
         c_first_name character(6),                                               +
         c_last_name character(8)                                                 +
 )                                                                                +
 WITH (orientation=column, compression=middle, colversion=2.0, enable_delta=false)+
 DISTRIBUTE BY HASH(c_last_name)                                                  +
 TO GROUP group_version1;
(1 row)