ALTER TABLE DETACH PARTITION
Makes partition data unavailable for reads and prepares partition directory for transportation. A partition detached by this SQL keyword can be "re-attached" using the complementary SQL keyword ALTER TABLE ATTACH PARTITION.
#
Syntax#
ExampleTo detach one or more partitions, let's assume table x
with 3 partitions, 2019-02-01
, 2019-02-02
, and 2019-02-03
:
Detach two partitions using the SQL
ALTER TABLE DETACH PARTITION
command:
Users can move the partition, for example, to an S3 bucket:
The table directory is nested in the root directory. The root directory is set by
cairo.root
and is set todb
by default. The detached partition files have the suffix.detached
.
#
Limitation- QuestDB does not compress partitions after detaching nor does it change partition format significantly. In most cases, compression will have to be done manually before partitions are transported to cold storage.
- The operation does not support detaching:
- An active (the last) partition.
- The only partition in case of non-partitioned tables.