show_tablespaces command.
How hypertable chunks are assigned tablespaces
A can be partitioned in multiple dimensions, but only one of the dimensions is used to determine the tablespace assigned to a particular . If a has one or more hash-partitioned, or space, dimensions, it uses the first hash-partitioned dimension. Otherwise, it uses the first time dimension. This strategy ensures that hash-partitioned s have s co-located according to hash partition, as long as the list of tablespaces attached to the remains the same. Modulo calculation is used to pick a tablespace, so there can be more partitions than tablespaces. For example, if there are two tablespaces, partition number three uses the first tablespace. s that are only time-partitioned add new partitions continuously, and therefore have s assigned to tablespaces in a way similar to round-robin.It is possible to attach more tablespaces than there are partitions for the . In this case, some
tablespaces remain unused until others are detached or additional partitions are added. This is especially true for
hash-partitioned tables.
Automatic tablespace management
Moving older data to a different tablespace can help you save on storage costs. supports automatic tablespace management by providing themove_chunk function to move chunks between tablespaces. To schedule the moves automatically, you can write a custom .
On , use tiered storage which handles this by providing a tiering policy API to move data to low-cost object storage backed by Amazon S3.
-
Create a procedure that moves chunks to a different tablespace
This procedure moves s to a different tablespace if they contain data older than the
lagparameter. -
Register the job to run daily
In the config, set
hypertabletometricsto implement automatic moves on themetrics. Setlagto 12 months to move s containing data older than 12 months. Settablespaceto the destination tablespace.