Skip to main content
Since 2.18.0 Merge two or more s into one. The partition boundaries for the new is the union of all partitions of the merged s. The new retains the name, constraints, and triggers of the first in the partition order. You can only merge s that have directly adjacent partitions. It is not possible to merge s that have another , or an empty range between them in any of the partitioning dimensions. merging has the following limitations. You cannot:
  • Merge s with tiered data
  • Write to s that are being merged

Concurrent mode

When a merge is executed using the concurrently option, other processes can simultaneously read from the s being merged and insert into other s. The merge happens across two transactions: the first one rewrites the s into a temporary relation without taking any locks that prevent reads, while the second transaction locks out all other operations before swapping the old relations for the new one. The second operation completes quickly so it should not significantly affect other operations.

Samples

  • Merge two s:
  • Merge more than two s:
  • Merge two s concurrently, allowing reads:

Arguments

The syntax is:
You can merge either two s, or an arbitrary number of s specified as an array of identifiers. When you call merge_chunks, you must specify either chunk1 and chunk2, or chunks. You cannot use both arguments. The concurrently option is only available for the two-chunk overload. To merge an array of s concurrently, use merge_chunks_concurrently() instead.

Returns

This procedure does not return a value. Upon successful completion, the specified s are merged into a single .