Help Center> GaussDB(DWS)> User Guide (Paris Region)> FAQs> Database Usage> How Do I Check Whether a Table Is Row-Stored or Column-Stored?
Updated on 2024-06-11 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.

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)