> ## 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.

# chunks_detailed_size()

> Get detailed information about disk space used by chunks

export const CHUNK_CAP = 'Chunk';

export const CHUNK = 'chunk';

export const HYPERTABLE_CAP = 'Hypertable';

export const HYPERTABLE = 'hypertable';

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

Get information about the disk space used by the {CHUNK}s belonging to a
{HYPERTABLE}, returning size information for each {CHUNK} table, any
indexes on the {CHUNK}, any toast tables, and the total size associated
with the {CHUNK}. All sizes are reported in bytes.

If the function is executed on a distributed {HYPERTABLE}, it returns
disk space usage information as a separate row per node. The access
node is not included since it doesn't have any local {CHUNK} data.

Additional metadata associated with a {CHUNK} can be accessed
via the `timescaledb_information.chunks` view.

## Samples

```sql theme={"dark"}
SELECT * FROM chunks_detailed_size('dist_table')
  ORDER BY chunk_name, node_name;

     chunk_schema      |      chunk_name       | table_bytes | index_bytes | toast_bytes | total_bytes |       node_name
-----------------------+-----------------------+-------------+-------------+-------------+-------------+-----------------------
 _timescaledb_internal | _dist_hyper_1_1_chunk |        8192 |       32768 |           0 |       40960 | data_node_1
 _timescaledb_internal | _dist_hyper_1_2_chunk |        8192 |       32768 |           0 |       40960 | data_node_2
 _timescaledb_internal | _dist_hyper_1_3_chunk |        8192 |       32768 |           0 |       40960 | data_node_3
```

## Arguments

The syntax is:

```sql theme={"dark"}
SELECT * FROM chunks_detailed_size('<hypertable_name>');
```

| Name         | Type     | Default | Required | Description            |
| ------------ | -------- | ------- | -------- | ---------------------- |
| `hypertable` | REGCLASS | -       | ✔        | Name of the hypertable |

## Returns

| Column        | Type   | Description                                                                   |
| ------------- | ------ | ----------------------------------------------------------------------------- |
| chunk\_schema | TEXT   | Schema name of the {CHUNK}                                                    |
| chunk\_name   | TEXT   | Name of the {CHUNK}                                                           |
| table\_bytes  | BIGINT | Disk space used by the {CHUNK} table                                          |
| index\_bytes  | BIGINT | Disk space used by indexes                                                    |
| toast\_bytes  | BIGINT | Disk space of toast tables                                                    |
| total\_bytes  | BIGINT | Total disk space used by the {CHUNK}, including all indexes and TOAST data    |
| node\_name    | TEXT   | Node for which size is reported, applicable only to distributed {HYPERTABLE}s |

<Note>
  If executed on a relation that is not a {HYPERTABLE}, the function returns `NULL`.
</Note>

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