---
title: chunk_columnstore_stats() | Tiger Data Docs
description: Get statistics about chunks in the columnstore
---

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

`chunk_columnstore_stats()` replaces `chunk_compression_stats()`, deprecated in 2.18.0. The parameters are the same.

Retrieve statistics about the chunks in the columnstore

`chunk_columnstore_stats` returns the size of chunks in the columnstore, these values are computed when you call either:

- [CREATE TABLE](/docs/reference/timescaledb/hypertables/create_table/index.md): create a hypertable with a default [job](/docs/reference/timescaledb/jobs-automation/add_job/index.md) that automatically moves chunks in a hypertable to the columnstore at a specific time interval.
- [add\_columnstore\_policy](/docs/reference/timescaledb/hypercore/add_columnstore_policy/index.md): create a [job](/docs/reference/timescaledb/jobs-automation/add_job/index.md) on an existing hypertable that automatically moves chunks in a hypertable to the columnstore at a specific time interval.
- [convert\_to\_columnstore](/docs/reference/timescaledb/hypercore/convert_to_columnstore/index.md): manually add a specific chunk in a hypertable to the columnstore.

Inserting into a chunk in the columnstore does not change the chunk size. For more information about how to compute chunk sizes, see [chunks\_detailed\_size](/docs/reference/timescaledb/hypertables/chunks_detailed_size/index.md).

## Samples

To retrieve statistics about chunks:

- **Show the status of the first two chunks in the `conditions` hypertable**:

  ```
  SELECT * FROM chunk_columnstore_stats('conditions')
    ORDER BY chunk_name LIMIT 2;
  ```

  Returns:

  ```
  -[ RECORD 1 ]------------------+----------------------
  chunk_schema                   | _timescaledb_internal
  chunk_name                     | _hyper_1_1_chunk
  compression_status             | Uncompressed
  before_compression_table_bytes |
  before_compression_index_bytes |
  before_compression_toast_bytes |
  before_compression_total_bytes |
  after_compression_table_bytes  |
  after_compression_index_bytes  |
  after_compression_toast_bytes  |
  after_compression_total_bytes  |
  node_name                      |
  -[ RECORD 2 ]------------------+----------------------
  chunk_schema                   | _timescaledb_internal
  chunk_name                     | _hyper_1_2_chunk
  compression_status             | Compressed
  before_compression_table_bytes | 8192
  before_compression_index_bytes | 32768
  before_compression_toast_bytes | 0
  before_compression_total_bytes | 40960
  after_compression_table_bytes  | 8192
  after_compression_index_bytes  | 32768
  after_compression_toast_bytes  | 8192
  after_compression_total_bytes  | 49152
  node_name                      |
  ```

- **Use `pg_size_pretty` to return a more human friendly format**:

  ```
  SELECT pg_size_pretty(after_compression_total_bytes) AS total
    FROM chunk_columnstore_stats('conditions')
    WHERE compression_status = 'Compressed';
  ```

  Returns:

  ```
  -[ RECORD 1 ]--+------
  total | 48 kB
  ```

## Arguments

The syntax is:

```
SELECT * FROM chunk_columnstore_stats('<hypertable_name>');
```

| Name         | Type       | Default | Required | Description              |
| ------------ | ---------- | ------- | -------- | ------------------------ |
| `hypertable` | `REGCLASS` | -       | ✔        | The name of a hypertable |

## Returns

| Column                           | Type   | Description                                                                                                                                                                                                           |
| -------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chunk_schema`                   | NAME   | Schema name of the chunk.                                                                                                                                                                                             |
| `chunk_name`                     | NAME   | Name of the chunk.                                                                                                                                                                                                    |
| `compression_status`             | TEXT   | Current compression status of the chunk.                                                                                                                                                                              |
| `before_compression_table_bytes` | BIGINT | Size of the heap before compression. Returns `NULL` if `compression_status` == `Uncompressed`.                                                                                                                        |
| `before_compression_index_bytes` | BIGINT | Size of all the indexes before compression. Returns `NULL` if `compression_status` == `Uncompressed`.                                                                                                                 |
| `before_compression_toast_bytes` | BIGINT | Size the TOAST table before compression. Returns `NULL` if `compression_status` == `Uncompressed`.                                                                                                                    |
| `before_compression_total_bytes` | BIGINT | Size of the entire chunk table (`before_compression_table_bytes` + `before_compression_index_bytes` + `before_compression_toast_bytes`) before compression. Returns `NULL` if `compression_status` == `Uncompressed`. |
| `after_compression_table_bytes`  | BIGINT | Size of the heap after compression. Returns `NULL` if `compression_status` == `Uncompressed`.                                                                                                                         |
| `after_compression_index_bytes`  | BIGINT | Size of all the indexes after compression. Returns `NULL` if `compression_status` == `Uncompressed`.                                                                                                                  |
| `after_compression_toast_bytes`  | BIGINT | Size the TOAST table after compression. Returns `NULL` if `compression_status` == `Uncompressed`.                                                                                                                     |
| `after_compression_total_bytes`  | BIGINT | Size of the entire chunk table (`after_compression_table_bytes` + `after_compression_index_bytes `+ `after_compression_toast_bytes`) after compression. Returns `NULL` if `compression_status` == `Uncompressed`.     |
| `node_name`                      | NAME   | **DEPRECATED**: nodes the chunk is located on, applicable only to distributed hypertables.                                                                                                                            |
