Tables APPEND_ONLY

In QHB, it is possible to create tables with a special parameter APPEND_ONLY to speed up operations with them. This parameter is intended for tables that are not modified, such as logs, data from sensors, etc. You can only add entries to such tables, but this is executed at maximum speed, since full MVCC analysis is not performed.

This storage option also has the following features:

  • There is no need for autovacuum.
  • All index types are supported.
  • To remove old data, you can use table partitioning and delete data by partitions, or use the TRUNCATE command.
  • Mechanism TOAST is not supported.

To create a table with APPEND_ONLY you need to execute the query:

CREATE TABLE table_name (...) USING APPEND_ONLY;

Also, to speed up operations with the table, you can create a table with the parameter HOLDMEM. To do this, you must specify the parameter UNLOGGED and add WITH (HOLDMEM = ONLY) while creating the table. The query for creating such a table looks like:

CREATE UNLOGGED TABLE имя_таблицы (...) USING APPEND_ONLY WITH (HOLDMEM = ONLY)