Merge two or more chunks into one.

The partition boundaries for the new chunk is the union of all partitions of the merged chunks. The new chunk retains the name, constraints, and triggers of the first chunk in the partition order.

You can only merge chunks that have directly adjacent partitions. It is not possible to merge chunks that have another chunk, or an empty range between them in any of the partitioning dimensions.

In this first release, chunk merging has the following limitations. You cannot:

  • Merge compressed chunks
  • Merge chunks using table access methods other than heap
  • Merge chunks with tiered data
  • Read or write from the chunks while they are being merged
  • Merge two chunks:

    CALL merge_chunks('_timescaledb_internal._hyper_1_1_chunk', '_timescaledb_internal._hyper_1_2_chunk');
  • Merge more than two chunks:

    CALL merge_chunks('{_timescaledb_internal._hyper_1_1_chunk, _timescaledb_internal._hyper_1_2_chunk, _timescaledb_internal._hyper_1_3_chunk}');

You can merge either two chunks, or an arbitrary number of chunks specified as an array of chunk identifiers. When you call merge_chunks, you must specify either chunk1 and chunk2, or chunks. You cannot use both arguments.

NameTypeDefaultRequiredDescription
chunk1, chunk2REGCLASS-The two chunk to merge in partition order
chunksREGCLASS[]-The array of chunks to merge in partition order

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.