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

# hypertable_detailed_size()

> Get detailed information about disk space used by a hypertable

export const CAGG = 'continuous aggregate';

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 detailed information about disk space used by a {HYPERTABLE} or
{CAGG}, returning size information for the table
itself, any indexes on the table, any toast tables, and the total
size of all. All sizes are reported in bytes. If the function is
executed on a distributed {HYPERTABLE}, it returns size information
as a separate row per node, including the access node.

<Note>
  When a {CAGG} name is provided, the function
  transparently looks up the backing {HYPERTABLE} and returns its statistics
  instead.
</Note>

For more information about using {HYPERTABLE}s, including {CHUNK} size partitioning,
see the [hypertable section][hypertable-docs].

## Samples

Get the size information for a {HYPERTABLE}.

```sql theme={"dark"}
-- disttable is a distributed {HYPERTABLE} --
SELECT * FROM hypertable_detailed_size('disttable') ORDER BY node_name;

 table_bytes | index_bytes | toast_bytes | total_bytes |  node_name
-------------+-------------+-------------+-------------+-------------
       16384 |       40960 |           0 |       57344 | data_node_1
        8192 |       24576 |           0 |       32768 | data_node_2
           0 |        8192 |           0 |        8192 |

```

The access node is listed without a user-given node name. Normally,
the access node holds no data, but still maintains, for example, index
information that occupies a small amount of disk space.

## Arguments

The syntax is:

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

| Name         | Type     | Default | Required | Description                                                  |
| ------------ | -------- | ------- | -------- | ------------------------------------------------------------ |
| `hypertable` | REGCLASS | -       | ✔        | Hypertable or continuous aggregate to show detailed size of. |

## Returns

| Column       | Type   | Description                                                                                                                                                                      |
| ------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| table\_bytes | BIGINT | Disk space used by main\_table (like `pg_relation_size(main_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 specified table, including all indexes and TOAST data                                                                                               |
| node\_name   | TEXT   | For distributed {HYPERTABLE}s, this is the user-given name of the node for which the size is reported. `NULL` is returned for the access node and non-distributed {HYPERTABLE}s. |

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

[hypertable-docs]: /use-timescale/hypertables/

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