Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hypertable_(detailed_)size functions now supports CAGG name #2086

Merged
merged 6 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions api/hypertable_detailed_size.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ api:

# hypertable_detailed_size()

Get detailed information about disk space used by a hypertable,
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.
Get detailed information about disk space used by a hypertable or
continuous aggregate, 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.

<Highlight type="tip">
When a continuous aggregate name is provided, the function will
transparently look up the backing hypertable and return its statistics
noctarius marked this conversation as resolved.
Show resolved Hide resolved
instead.
</Highlight>

### Required arguments

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

### Returns

Expand Down
31 changes: 24 additions & 7 deletions api/hypertable_size.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,24 @@ api:

# hypertable_size()

Get the total disk space used by a hypertable, that is, the sum of the
size for the table itself (including chunks), any indexes on the
table, and any toast tables. The size is reported in bytes. This is
equivalent to computing the sum of `total_bytes` column from the
output of `hypertable_detailed_size` function.
Get the total disk space used by a hypertable or continuous aggregate,
that is, the sum of the size for the table itself (including chunks),
noctarius marked this conversation as resolved.
Show resolved Hide resolved
any indexes on the table, and any toast tables. The size is reported
in bytes. This is equivalent to computing the sum of `total_bytes`
column from the output of `hypertable_detailed_size` function.

<Highlight type="tip">
When a continuous aggregate name is provided, the function will
transparently look up the backing hypertable and return its statistics
noctarius marked this conversation as resolved.
Show resolved Hide resolved
instead.

</Highlight>

### Required arguments

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

### Returns

Expand All @@ -38,7 +45,7 @@ output of `hypertable_detailed_size` function.
Get size information for a hypertable.

```sql
SELECT hypertable_size('devices') ;
SELECT hypertable_size('devices');

hypertable_size
-----------------
Expand All @@ -51,3 +58,13 @@ Get size information for all hypertables.
SELECT hypertable_name, hypertable_size(format('%I.%I', hypertable_schema, hypertable_name)::regclass)
FROM timescaledb_information.hypertables;
```

Get size of a continuous aggregate.
Loquacity marked this conversation as resolved.
Show resolved Hide resolved

```sql
SELECT hypertable_size('device_stats_15m');

hypertable_size
-----------------
73728
```
8 changes: 8 additions & 0 deletions api/page-index/page-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ module.exports = [
title: "remove_all_policies",
href: "remove_all_policies",
},
{
title: "hypertable_size",
href: "hypertable_size",
},
{
title: "hypertable_detailed_size",
href: "hypertable_detailed_size",
},
],
},
{
Expand Down