---
title: convert_to_columnstore() | Tiger Data Docs
description: Manually add a chunk to the columnstore
---

Since [2.18.0](https://github.com/timescale/timescaledb/releases/tag/2.18.0)

`convert_to_columnstore()` replaces `compress_chunk()`, deprecated in 2.18.0.

Manually convert a specific chunk in the hypertable rowstore to the columnstore.

Although `convert_to_columnstore` gives you more fine-grained control, best practice is to use [`add_columnstore_policy`](/reference/timescaledb/hypercore/add_columnstore_policy/index.md). You can also add chunks to the columnstore at a specific time [running the job associated with your columnstore policy](/reference/timescaledb/jobs-automation/run_job/index.md) manually.

To move a chunk from the columnstore back to the rowstore, use [`convert_to_rowstore`](/reference/timescaledb/hypercore/convert_to_rowstore/index.md).

## Samples

To convert a single chunk to columnstore:

```
CALL convert_to_columnstore('_timescaledb_internal._hyper_1_2_chunk');
```

To convert a backlog of chunks on an existing hypertable, list the chunks with [show\_chunks](/reference/timescaledb/hypertables/show_chunks/index.md) and call `convert_to_columnstore` on each one. chunks are converted independently, so you can run multiple calls from separate sessions in parallel to speed up an initial migration:

```
-- Session 1
CALL convert_to_columnstore('_timescaledb_internal._hyper_1_2_chunk');


-- Session 2 (concurrent)
CALL convert_to_columnstore('_timescaledb_internal._hyper_1_3_chunk');
```

Each call takes an exclusive lock on the chunk it is converting, so concurrent writes or backfill to the same chunk will wait. For backfill workflows, pause the columnstore policy first — see [convert\_to\_rowstore](/reference/timescaledb/hypercore/convert_to_rowstore/index.md).

## Arguments

The syntax is:

```
CALL convert_to_columnstore(
    chunk = '<chunk_name>',
    if_not_columnstore = true | false,
    recompress = true | false
);
```

| Name                 | Type     | Default | Required | Description                                                                                                             |
| -------------------- | -------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| `chunk`              | REGCLASS | -       | ✔        | Name of the chunk to add to the columnstore.                                                                            |
| `if_not_columnstore` | BOOLEAN  | `true`  | ✖        | Set to `false` so this call fails with an error rather than a warning if `chunk` is already in the columnstore.         |
| `recompress`         | BOOLEAN  | `false` | ✖        | Set to `true` to recompress. In-memory recompression is attempted first; it falls back to internal decompress/compress. |

## Returns

This function returns void.
