> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# detach_chunk()

> Detach a chunk from a hypertable.

export const HYPERTABLE_CAP = 'Hypertable';

export const HYPERTABLE = 'hypertable';

export const COLUMNSTORE = 'columnstore';

export const CHUNK_CAP = 'Chunk';

export const CHUNK = 'chunk';

<Icon icon="tag" iconType="duotone" /> Since [2.21.0][tsdb-2.21.0]

<Tag>Community</Tag>

Separate a {CHUNK} from a [{HYPERTABLE}][hypertables-section].

![Hypertable structure][hypertable-structure]

The {CHUNK} becomes a standalone {HYPERTABLE} with the same name and schema. All existing constraints and
indexes on the {CHUNK} are preserved after detaching. Foreign keys are dropped.

In this initial release, you cannot detach a {CHUNK} that has been [converted to the {COLUMNSTORE}][setup-hypercore].

## Samples

Detach a {CHUNK} from a {HYPERTABLE}:

```sql theme={"dark"}
CALL detach_chunk('_timescaledb_internal._hyper_1_2_chunk');
```

## Arguments

The syntax is:

```sql theme={"dark"}
CALL detach_chunk(
    chunk = '<chunk_name>'
);
```

| Name    | Type     | Description                    |
| ------- | -------- | ------------------------------ |
| `chunk` | REGCLASS | Name of the {CHUNK} to detach. |

## Returns

This function returns void.

[hypertable-structure]: https://assets.timescale.com/docs/images/hypertable-structure.png

[hypertables-section]: /use-timescale/hypertables/

[setup-hypercore]: /use-timescale/hypercore/real-time-analytics-in-hypercore/

[tsdb-2.21.0]: https://github.com/timescale/timescaledb/releases/tag/2.21.0
