Table types
Overview
ADB (as well as Greenplum) supports several types of tables with different data storage models:
-
Heap. This is the default table type. Heap tables are recommended for OLTP-type workloads. You can use them if the data is frequently modified after being initially loaded. It is also the most suitable kind of tables for single-row queries
INSERT
,UPDATE
, andDELETE
. -
Append-optimized. These tables are preferable for OLAP-type workloads. They are also optimized for bulk data loading. You can use them if the data is rarely modified after being initially loaded, i.e. the read-only queries prevail. Unlike Heap tables (that can be only row-oriented), append-optimized tables support two forms of data orientation:
-
Row-oriented. This storage model is recommended for retrieving all or the most part of the table columns at once.
-
Column-oriented. This model is good for data computing over a small number of columns. You can also use it for tables that need regular updates of the small part of columns — without modifying the rest of them.
-
When you create a new table, you should choose the most suitable table type. The following subsections show the difference between the table types that are possible in ADB. This information can be useful for choosing the best storage model for your workloads.
Heap vs Append-optimized
Criteria | Heap | Append-optimized |
---|---|---|
Load |
OLTP |
OLAP |
Size of tables |
Small tables, e.g. dimension tables |
Denormalized fact tables that are typically the largest ones in the system |
Frequency of data updates after the initial loading |
Often |
Rarely |
Prevailing queries |
Many iterative transactions including single-row updates and parallel batch operations |
|
Ability to define unique values |
Supported — by using the |
— |
Compression |
— |
|
Syntax |
Heap tables are created by default:
|
In order to create an append-optimized table, you should use the
|
Recommendations on usage |
OLTP-type workloads — with many iterative transactions over small tables |
Data Warehouse environment (OLAP-type workloads) — with bulk loading and subsequent read-only requests over large denormalized tables |
CAUTION
It is not recommended to perform the following commands over append-optimized tables due to their inefficiency:
|
Row-oriented vs Column-oriented
Criteria | Row-oriented | Column-oriented |
---|---|---|
Table type |
Heap & Append-optimized |
Append-optimized |
Frequency of data updates after the initial loading |
Often |
Rarely |
Frequency of data inserting |
Often |
Rarely
|
Number of columns in the table |
Relatively small |
Many columns (dozens or more) |
Number of requested columns |
All or the majority of columns |
A small subset of columns |
Prevailing queries |
Any |
|
Compression |
Possible on the table level in append-optimized tables.
|
Possible on the table and the column levels in append-optimized tables.
|
Syntax |
|
Append-optimized only:
|
Recommendations on usage |
|
Data Warehouse environment (OLAP-type workloads) — with aggregations of many values of a single column or regular selects/updates of small number of columns |