updates partitioning information, closes #5561

pull/5574/head
Scott Anderson 2024-08-22 11:50:59 -06:00
parent 78b99259bc
commit f6a47ac800
17 changed files with 478 additions and 422 deletions

View File

@ -47,12 +47,9 @@ As you plan your partitioning strategy, keep in mind that data can be
having to retrieve and read many partitions from the object store, which
hurts query performance.
- Avoid using partition time intervals that are **less than one day**.
The partition time interval should be balanced with the actual amount of data
written during each interval. If a single interval doesn't contain a lot of data,
- Balance the partition time interval with the actual amount of data written
during each interval. If a single interval doesn't contain a lot of data,
it is better to partition by larger time intervals.
- Don't partition by tags that you typically don't use in your query workload.
- Don't partition by distinct values of high-cardinality tags.
Instead, [use tag buckets](#use-tag-buckets-for-high-cardinality-tags) to

View File

@ -28,13 +28,13 @@ table.
- [Create a table with a custom partition template](#create-a-table-with-a-custom-partition-template)
- [Example partition templates](#example-partition-templates)
{{% note %}}
{{% warn %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a database or table.
You can't update a partition template on an existing resource.
{{% /note %}}
{{% /warn %}}
Use the following command flags to identify
[partition template parts](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#tag-part-templates):
@ -69,7 +69,7 @@ Otherwise, InfluxDB omits time from the partition template and won't compact par
The following example creates a new `example-db` database and applies a partition
template that partitions by distinct values of two tags (`room` and `sensor-type`),
bucketed values of the `customerID` tag, and by week using the time format `%Y wk:%W`:
bucketed values of the `customerID` tag, and by day using the time format `%Y-%m-%d`:
<!--Skip database create and delete tests: namespaces aren't reusable-->
<!--pytest.mark.skip-->
@ -79,7 +79,7 @@ influxctl database create \
--template-tag room \
--template-tag sensor-type \
--template-tag-bucket customerID,500 \
--template-timeformat '%Y wk:%W' \
--template-timeformat '%Y-%m-%d' \
example-db
```
@ -150,22 +150,21 @@ prod,line=A,station=weld1 temp=81.9,qty=36i 1704067200000000000
##### Partitioning by distinct tag values
| Description | Tag parts | Time part | Resulting partition key |
| Description | Tag parts | Time part | Resulting partition key |
| :---------------------- | :---------------- | :--------- | :----------------------- |
| By day (default) | | `%Y-%m-%d` | 2024-01-01 |
| By day (non-default) | | `%d %b %Y` | 01 Jan 2024 |
| By week | | `%Y wk:%W` | 2024 wk:01 |
| By month | | `%Y-%m` | 2024-01 |
| Single tag, by day | `line` | `%F` | A \| 2024-01-01 |
| Single tag, by week | `line` | `%Y wk:%W` | A \| 2024 wk:01 |
| By year | | `%Y` | 2024 |
| Single tag, by day | `line` | `%Y-%m-%d` | A \| 2024-01-01 |
| Single tag, by month | `line` | `%Y-%m` | A \| 2024-01 |
| Multiple tags, by day | `line`, `station` | `%F` | A \| weld1 \| 2024-01-01 |
| Multiple tags, by week | `line`, `station` | `%Y wk:%W` | A \| weld1 \| 2024 wk:01 |
| Single tag, by year | `line` | `%Y` | A \| 2024 |
| Multiple tags, by day | `line`, `station` | `%Y-%m-%d` | A \| weld1 \| 2024-01-01 |
| Multiple tags, by month | `line`, `station` | `%Y-%m` | A \| weld1 \| 2024-01 |
| Multiple tags, by year | `line`, `station` | `%Y` | A \| weld1 \| 2024 |
##### Partition by tag buckets
| Description | Tag part | Tag bucket part | Time part | Resulting partition key |
| :--------------------------------- | :------- | :-------------- | :--------- | :---------------------- |
| Distinct tag, tag buckets, by day | `line` | `station,100` | `%F` | A \| 3 \| 2024-01-01 |
| Distinct tag, tag buckets, by week | `line` | `station,500` | `%Y wk:%W` | A \| 303 \| 2024 wk:01 |
| Description | Tag part | Tag bucket part | Time part | Resulting partition key |
| :---------------------------------- | :------- | :-------------- | :--------- | :---------------------- |
| Distinct tag, tag buckets, by day | `line` | `station,100` | `%Y-%m-%d` | A \| 3 \| 2024-01-01 |
| Distinct tag, tag buckets, by month | `line` | `station,500` | `%Y-%m` | A \| 303 \| 2024-01 |

View File

@ -39,11 +39,6 @@ and only 1 time part.
- [Tag part templates](#tag-part-templates)
- [Tag bucket part templates](#tag-bucket-part-templates)
- [Time part templates](#time-part-templates)
- [Date specifiers](#date-specifiers)
- [Time specifiers](#time-specifiers)
- [Time zone specifiers](#time-zone-specifiers)
- [Date and time specifiers](#date-and-time-specifiers)
- [Special specifiers](#special-specifiers)
<!-- /TOC -->
## Restrictions
@ -109,175 +104,16 @@ unknown number of distinct values.
## Time part templates
Time part templates use [Rust strftime date and time formatting syntax](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
Time part templates use a limited subset of the
[Rust strftime date and time formatting syntax](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
to specify time format in partition keys.
The smallest unit of time included in the time part template is the interval
used to partition data.
{{% warn %}}
#### Avoid partitioning by less than one day
We do not recommend using time intervals less than one day to partition data.
This can result in [over-partitioned data](/influxdb/cloud-dedicated/admin/custom-partitions/best-practices/#avoid-over-partitioning)
and may hurt query performance.
{{% /warn %}}
- [Date specifiers](#date-specifiers)
- [Time specifiers](#time-specifiers)
- [Time zone specifiers](#time-zone-specifiers)
- [Date and time specifiers](#date-and-time-specifiers)
- [Special specifiers](#special-specifiers)
{{% note %}}
The following is adapted from the
[Rust strftime source code](https://docs.rs/chrono/latest/src/chrono/format/strftime.rs.html).
{{% /note %}}
InfluxDB uses the smallest unit of time included in the time part template as
the partition interval.
### Date specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `%Y` | `2001` | The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143. Note: years before 1 BCE or after 9999 CE, require an initial sign (+/-). |
| `%C` | `20` | The proleptic Gregorian year divided by 100, zero-padded to 2 digits. [^1] |
| `%y` | `01` | The proleptic Gregorian year modulo 100, zero-padded to 2 digits. [^1] |
| `%m` | `07` | Month number (01--12), zero-padded to 2 digits. |
| `%b` | `Jul` | Abbreviated month name. Always 3 letters. |
| `%B` | `July` | Full month name. Also accepts corresponding abbreviation in parsing. |
| `%h` | `Jul` | Same as `%b`. |
| `%d` | `08` | Day number (01--31), zero-padded to 2 digits. |
| `%e` | ` 8` | Same as `%d` but space-padded. Same as `%_d`. |
| `%a` | `Sun` | Abbreviated weekday name. Always 3 letters. |
| `%A` | `Sunday` | Full weekday name. Also accepts corresponding abbreviation in parsing. |
| `%w` | `0` | Sunday = 0, Monday = 1, ..., Saturday = 6. |
| `%u` | `7` | Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601) |
| `%U` | `28` | Week number starting with Sunday (00--53), zero-padded to 2 digits. [^2] |
| `%W` | `27` | Same as `%U`, but week 1 starts with the first Monday in that year instead. |
| `%G` | `2001` | Same as `%Y` but uses the year number in ISO 8601 week date. [^3] |
| `%g` | `01` | Same as `%y` but uses the year number in ISO 8601 week date. [^3] |
| `%V` | `27` | Same as `%U` but uses the week number in ISO 8601 week date (01--53). [^3] |
| `%j` | `189` | Day of the year (001--366), zero-padded to 3 digits. |
| `%D` | `07/08/01` | Month-day-year format. Same as `%m/%d/%y`. |
| `%x` | `07/08/01` | Locale's date representation (e.g., 12/31/99). |
| `%F` | `2001-07-08` | Year-month-day format (ISO 8601). Same as `%Y-%m-%d`. |
| `%v` | ` 8-Jul-2001` | Day-month-year format. Same as `%e-%b-%Y`. |
### Time specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
| `%H` | `00` | Hour number (00--23), zero-padded to 2 digits. |
| `%k` | ` 0` | Same as `%H` but space-padded. Same as `%_H`. |
| `%I` | `12` | Hour number in 12-hour clocks (01--12), zero-padded to 2 digits. |
| `%l` | `12` | Same as `%I` but space-padded. Same as `%_I`. |
| `%P` | `am` | `am` or `pm` in 12-hour clocks. |
| `%p` | `AM` | `AM` or `PM` in 12-hour clocks. |
| `%M` | `34` | Minute number (00--59), zero-padded to 2 digits. |
| `%S` | `60` | Second number (00--60), zero-padded to 2 digits. [^4] |
| `%f` | `26490000` | Number of nanoseconds since last whole second. [^7] |
| `%.f` | `.026490` | Decimal fraction of a second. Consumes the leading dot. [^7] |
| `%.3f` | `.026` | Decimal fraction of a second with a fixed length of 3. |
| `%.6f` | `.026490` | Decimal fraction of a second with a fixed length of 6. |
| `%.9f` | `.026490000` | Decimal fraction of a second with a fixed length of 9. |
| `%3f` | `026` | Decimal fraction of a second like `%.3f` but without the leading dot. |
| `%6f` | `026490` | Decimal fraction of a second like `%.6f` but without the leading dot. |
| `%9f` | `026490000` | Decimal fraction of a second like `%.9f` but without the leading dot. |
| `%R` | `00:34` | Hour-minute format. Same as `%H:%M`. |
| `%T` | `00:34:60` | Hour-minute-second format. Same as `%H:%M:%S`. |
| `%X` | `00:34:60` | Locale's time representation (e.g., 23:13:48). |
| `%r` | `12:34:60 AM` | Locale's 12 hour clock time. (e.g., 11:11:04 PM). Falls back to `%X` if the locale does not have a 12 hour clock format. |
### Time zone specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :----------------------------------------------------------------------------------------------------------------- |
| `%Z` | `ACST` | Local time zone name. Skips all non-whitespace characters during parsing. Identical to `%:z` when formatting. [^8] |
| `%z` | `+0930` | Offset from the local time to UTC (with UTC being `+0000`). |
| `%:z` | `+09:30` | Same as `%z` but with a colon. |
| `%::z` | `+09:30:00` | Offset from the local time to UTC with seconds. |
| `%:::z` | `+09` | Offset from the local time to UTC without minutes. |
| `%#z` | `+09` | *Parsing only:* Same as `%z` but allows minutes to be missing or present. |
### Date and time specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :--------------------------------------------------------------------- |
| `%c` | `Sun Jul 8 00:34:60 2001` | Locale's date and time (e.g., Thu Mar 3 23:05:25 2005). |
| `%+` | `2001-07-08T00:34:60.026490+09:30` | ISO 8601 / RFC 3339 date & time format. [^5] |
| `%s` | `994518299` | UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. [^6] |
### Special specifiers
| Variable | Example | Description |
| :------: | :------ | :---------------------- |
| `%t` | | Literal tab (`\t`). |
| `%n` | | Literal newline (`\n`). |
| `%%` | | Literal percent sign. |
It is possible to override the default padding behavior of numeric specifiers `%?`.
This is not allowed for other specifiers and results in the `BAD_FORMAT` error.
Modifier | Description
-------- | -----------
`%-?` | Suppresses any padding including spaces and zeroes. (e.g. `%j` = `012`, `%-j` = `12`)
`%_?` | Uses spaces as a padding. (e.g. `%j` = `012`, `%_j` = ` 12`)
`%0?` | Uses zeroes as a padding. (e.g. `%e` = ` 9`, `%0e` = `09`)
Notes:
[^1]: `%C`, `%y`:
This is floor division, so 100 BCE (year number -99) will print `-1` and `99` respectively.
[^2]: `%U`:
Week 1 starts with the first Sunday in that year.
It is possible to have week 0 for days before the first Sunday.
[^3]: `%G`, `%g`, `%V`:
Week 1 is the first week with at least 4 days in that year.
Week 0 does not exist, so this should be used with `%G` or `%g`.
[^4]: `%S`:
It accounts for leap seconds, so `60` is possible.
[^5]: `%+`: Same as `%Y-%m-%dT%H:%M:%S%.f%:z`, i.e. 0, 3, 6 or 9 fractional
digits for seconds and colons in the time zone offset.
<br>
<br>
This format also supports having a `Z` or `UTC` in place of `%:z`. They
are equivalent to `+00:00`.
<br>
<br>
Note that all `T`, `Z`, and `UTC` are parsed case-insensitively.
<br>
<br>
The typical `strftime` implementations have different (and locale-dependent)
formats for this specifier. While Chrono's format for `%+` is far more
stable, it is best to avoid this specifier if you want to control the exact
output.
[^6]: `%s`:
This is not padded and can be negative.
For the purpose of Chrono, it only accounts for non-leap seconds
so it slightly differs from ISO C `strftime` behavior.
[^7]: `%f`, `%.f`:
<br>
`%f` and `%.f` are notably different formatting specifiers.<br>
`%f` counts the number of nanoseconds since the last whole second, while `%.f` is a fraction of a
second.<br>
Example: 7μs is formatted as `7000` with `%f`, and formatted as `.000007` with `%.f`.
[^8]: `%Z`:
Since `chrono` is not aware of timezones beyond their offsets, this specifier
**only prints the offset** when used for formatting. The timezone abbreviation
will NOT be printed. See [this issue](https://github.com/chronotope/chrono/issues/960)
for more information.
<br>
<br>
Offset will not be populated from the parsed data, nor will it be validated.
Timezone is completely ignored. Similar to the glibc `strptime` treatment of
this format code.
<br>
<br>
It is not possible to reliably convert from an abbreviation to an offset,
for example CDT can mean either Central Daylight Time (North America) or
China Daylight Time.
*/
| Variable | Example | Description |
| :------: | :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `%Y` | `2001` | The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143. Note: years before 1 BCE or after 9999 CE, require an initial sign (+/-). |
| `%m` | `07` | Month number (01--12), zero-padded to 2 digits. |
| `%d` | `08` | Day number (01--31), zero-padded to 2 digits. |

View File

@ -0,0 +1,199 @@
---
title: View partition information
description: >
Query partition information from InfluxDB v3 system tables to view partition
templates and verify partitions are working as intended.
menu:
influxdb_cloud_dedicated:
name: View partitions
parent: Manage data partitioning
weight: 202
list_code_example: |
```sql
SELECT * FROM system.partitions WHERE table_name = 'example-table'
```
related:
- /influxdb/cloud-dedicated/admin/query-system-data/
---
{{< product-name >}} stores partition information in InfluxDB v3 system tables.
Query partition information to view partition templates and verify partitions
are working as intended.
- [Query partition information from system tables](#query-partition-information-from-system-tables)
- [Partition-related queries](#partition-related-queries)
{{% warn %}}
#### Querying system tables may impact overall cluster performance
Partition information is stored in InfluxDB v3 system tables.
Querying system tables may impact the overall write and query performance of
your {{< product-name omit=" Clustered" >}} cluster.
<!--------------- UPDATE THE DATE BELOW AS EXAMPLES ARE UPDATED --------------->
#### System tables are subject to change
System tables are not part of InfluxDB's stable API and may change with new releases.
The provided schema information and query examples are valid as of **August 22, 2024**.
If you detect a schema change or a non-functioning query example, please
[submit an issue](https://github.com/influxdata/docs-v2/issues/new/choose).
<!--------------- UPDATE THE DATE ABOVE AS EXAMPLES ARE UPDATED --------------->
{{% /warn %}}
## Query partition information from system tables
Use the [`influxctl query` command](/influxdb/cloud-dedicated/reference/cli/influxctl/query/)
and SQL to query partition-related information from InfluxDB system tables.
Provide the following:
- **Enable system tables** with the `--enable-system-tables` command flag.
- **Database token**: A [database token](/influxdb/cloud-dedicated/admin/tokens/#database-tokens)
with read permissions on the specified database. Uses the `token` setting from
the [`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
or the `--token` command flag.
- **Database name**: The name of the database to query information about.
Uses the `database` setting from the
[`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
or the `--database` command flag.
- **SQL query**: The SQL query to execute.
Pass the query in one of the following ways:
- a string on the command line
- a path to a file that contains the query
- a single dash (`-`) to read the query from stdin
{{% code-placeholders "DATABASE_(TOKEN|NAME)|SQL_QUERY" %}}
<!--pytest.mark.skip-->
```bash
influxctl query \
--enable-system-tables \
--database DATABASE_NAME \
--token DATABASE_TOKEN \
"SQL_QUERY"
```
{{% /code-placeholders %}}
Replace the following:
- {{% code-placeholder-key %}}`DATABASE_TOKEN`{{% /code-placeholder-key %}}:
A database token with read access to the specified database
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
The name of the database to query information about.
- {{% code-placeholder-key %}}`SQL_QUERY`{{% /code-placeholder-key %}}:
The SQL query to execute. For examples, see
[System query examples](#system-query-examples).
When prompted, enter `y` to acknowledge the potential impact querying system
tables may have on your cluster.
## Partition-related queries
Use the following queries to return information about partitions in your
{{< product-name omit=" Clustered" >}} cluster.
- [View partition templates of all tables](#view-partition-templates-of-all-tables)
- [View the partition template of a specific table](#view-the-partition-template-of-a-specific-table)
- [View all partitions for a table](#view-all-partitions-for-a-table)
- [View the number of partitions per table](#view-the-number-of-partitions-per-table)
- [View the number of partitions for a specific table](#view-the-number-of-partitions-for-a-specific-table)
---
In the examples below, replace {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}
with the name of the table you want to query information about.
---
{{% code-placeholders "TABLE_NAME" %}}
### View partition templates of all tables
```sql
SELECT * FROM system.tables
```
#### Example results
| table_name | partition_template |
| :--------- | :--------------------------------------------------------------------------------------- |
| weather | {"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]} |
| home | {"parts":[{"timeFormat":"%Y-%m-%d"},{"tagValue":"room"},{"tagValue":"sensor_id"}]} |
| numbers | {"parts":[{"timeFormat":"%Y"}]} |
{{% note %}}
If a table doesn't include a partition template in the output of this command,
the tables uses the default partition strategy of one day and does not partition
by tags or tag buckets.
{{% /note %}}
### View the partition template of a specific table
```sql
SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'
```
#### Example results
| table_name | partition_template |
| :--------- | :--------------------------------------------------------------------------------------- |
| weather | {"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]} |
### View all partitions for a table
```sql
SELECT * FROM system.partitions WHERE table_name = 'TABLE_NAME'
```
### Example results
| partition_id | table_name | partition_key | last_new_file_created_at | num_files | total_size_mb |
| -----------: | :--------- | :---------------- | -----------------------: | --------: | ------------: |
| 1362 | weather | 43 \| 2020-05-27 | 1683747418763813713 | 1 | 0 |
| 800 | weather | 234 \| 2021-08-02 | 1683747421899400796 | 1 | 0 |
| 630 | weather | 325 \| 2022-03-17 | 1683747417616689036 | 1 | 0 |
| 1401 | weather | 12 \| 2021-01-09 | 1683747417786122295 | 1 | 0 |
| 1012 | weather | 115 \| 2022-07-04 | 1683747417614219148 | 1 | 0 |
### View the number of partitions per table
```sql
SELECT
table_name,
COUNT(*) AS partition_count
FROM
system.partitions
GROUP BY
table_name
```
### Example results
| table_name | partition_count |
| :--------- | --------------: |
| weather | 1096 |
| home | 24 |
| numbers | 1 |
### View the number of partitions for a specific table
```sql
SELECT
COUNT(*) AS partition_count
FROM
system.partitions
WHERE
table_name = 'TABLE_NAME'
```
### Example results
| table_name | partition_count |
| :--------- | --------------: |
| weather | 1096 |
{{% /code-placeholders %}}

View File

@ -194,14 +194,6 @@ flags to define partition template parts used to generate partition keys for the
For more information, see [Manage data partitioning](/influxdb/cloud-dedicated/admin/custom-partitions/).
{{% note %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a database.
You can't update a partition template on an existing database.
{{% /note %}}
<!-------------------------------- END INFLUXCTL ------------------------------>
{{% /tab-content %}}
{{% tab-content %}}
@ -235,7 +227,7 @@ _This example uses [cURL](https://curl.se/) to send a Management HTTP API reques
to use in the partition template. Limit is 7 total tags or tag buckets.
- _Optional_: [InfluxDB tag buckets](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#tag-bucket-part-templates)
to use in the partition template. Limit is 7 total tags or tag buckets.
- _Optional_: A [Rust strftime date and time string](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#time-part-templates)
- _Optional_: A supported [Rust strftime date and time string](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#time-part-templates)
that specifies the time format in the partition template and determines
the time interval to partition by. Default is `%Y-%m-%d`.
- Database name _(see [Database naming restrictions](#database-naming-restrictions))_.
@ -341,21 +333,23 @@ format in the InfluxDB v3 storage engine. By default, data is partitioned by day
but, depending on your schema and workload, customizing the partitioning
strategy can improve query performance.
Use the [`partitionTemplate`](/influxdb/cloud-dedicated/api/management/#operation/CreateClusterDatabase) property to define an array of partition template parts used to generate partition keys for the database.
Use the [`partitionTemplate`](/influxdb/cloud-dedicated/api/management/#operation/CreateClusterDatabase)
property to define an array of partition template parts used to generate
partition keys for the database.
For more information, see [Manage data partitioning](/influxdb/cloud-dedicated/admin/custom-partitions/).
{{% note %}}
<!------------------------------- END cURL ------------------------------------>
{{% /tab-content %}}
{{< /tabs-wrapper >}}
{{% warn %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a database.
You can't update a partition template on an existing database.
{{% /note %}}
<!------------------------------- END cURL ------------------------------------>
{{% /tab-content %}}
{{< /tabs-wrapper >}}
{{% /warn %}}
### Database naming restrictions

View File

@ -31,7 +31,7 @@ performance of your {{< product-name omit=" Clustered" >}} cluster.
#### System tables are subject to change
System tables are not part of InfluxDB's stable API and may change with new releases.
The provided schema information and query examples are valid as of **April 11, 2024**.
The provided schema information and query examples are valid as of **August 22, 2024**.
If you detect a schema change or a non-functioning query example, please
[submit an issue](https://github.com/influxdata/docs-v2/issues/new/choose).

View File

@ -34,7 +34,7 @@ to a table, you must manually create the table before you write any data to it.
to use in the partition template
- _Optional_: [InfluxDB tag buckets](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#tag-bucket-part-templates)
to use in the partition template
- _Optional_: A [Rust strftime date and time string](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#time-part-templates)
- _Optional_: A supported [Rust strftime date and time string](/influxdb/cloud-dedicated/admin/custom-partitions/partition-templates/#time-part-templates)
that specifies the time format in the partition template and determines
the time interval to partition by _(default is `%Y-%m-%d`)_
- The name of the database to create the table in
@ -71,9 +71,9 @@ If no template flags are provided, the table uses the partition template of the
target database.
For more information, see [Manage data partitioning](/influxdb/cloud-dedicated/admin/custom-partitions/).
{{% note %}}
{{% warn %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a table.
There is no way to update a partition template on an existing table.
{{% /note %}}
{{% /warn %}}

View File

@ -156,8 +156,8 @@ influxctl database create \
### Create a database with a custom partition template
The following example creates a new `mydb` database and applies a partition
template that partitions by two tags (`room` and `sensor-type`) and by week using
the time format `%Y wk:%W`:
template that partitions by two tags (`room` and `sensor-type`) and by day using
the time format `%d-%m-%Y`:
<!--Skip tests for database create and delete: namespaces aren't reusable-->
<!--pytest.mark.skip-->
@ -167,7 +167,7 @@ influxctl database create \
--template-tag room \
--template-tag sensor-type \
--template-tag-bucket customerID,1000 \
--template-timeformat '%Y wk:%W' \
--template-timeformat '%d-%m-%Y' \
mydb
```

View File

@ -82,8 +82,8 @@ influxctl table create DATABASE_NAME TABLE_NAME
### Create a table with a custom partition template
The following example creates a new table and applies a partition
template that partitions by two tags (`room` and `sensor-type`) and by week using
the time format `%Y wk:%W`:
template that partitions by two tags (`room` and `sensor-type`) and by day using
the time format `%d-%m-%Y`:
{{% code-placeholders "(DATABASE|TABLE)_NAME" %}}
```sh
@ -91,7 +91,7 @@ influxctl table create \
--template-tag room \
--template-tag sensor-type \
--template-tag-bucket customerID,1000 \
--template-timeformat '%Y wk:%W' \
--template-timeformat '%d-%m-%Y' \
DATABASE_NAME \
TABLE_NAME
```

View File

@ -47,12 +47,9 @@ As you plan your partitioning strategy, keep in mind that data can be
having to retrieve and read many partitions from the object store, which
hurts query performance.
- Avoid using partition time intervals that are **less than one day**.
The partition time interval should be balanced with the actual amount of data
written during each interval. If a single interval doesn't contain a lot of data,
- Balance the partition time interval with the actual amount of data written
during each interval. If a single interval doesn't contain a lot of data,
it is better to partition by larger time intervals.
- Don't partition by tags that you typically don't use in your query workload.
- Don't partition by distinct values of high-cardinality tags.
Instead, [use tag buckets](#use-tag-buckets-for-high-cardinality-tags) to

View File

@ -28,13 +28,13 @@ table.
- [Create a table with a custom partition template](#create-a-table-with-a-custom-partition-template)
- [Example partition templates](#example-partition-templates)
{{% note %}}
{{% warn %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a database or table.
You can't update a partition template on an existing resource.
{{% /note %}}
{{% /warn %}}
Use the following command flags to identify
[partition template parts](/influxdb/clustered/admin/custom-partitions/partition-templates/#tag-part-templates):
@ -69,7 +69,7 @@ Otherwise, InfluxDB omits time from the partition template and won't compact par
The following example creates a new `example-db` database and applies a partition
template that partitions by distinct values of two tags (`room` and `sensor-type`),
bucketed values of the `customerID` tag, and by week using the time format `%Y wk:%W`:
bucketed values of the `customerID` tag, and by day using the time format `%Y-%m-%d`:
<!--Skip database create and delete tests: namespaces aren't reusable-->
<!--pytest.mark.skip-->
@ -79,7 +79,7 @@ influxctl database create \
--template-tag room \
--template-tag sensor-type \
--template-tag-bucket customerID,500 \
--template-timeformat '%Y wk:%W' \
--template-timeformat '%Y-%m-%d' \
example-db
```
@ -150,22 +150,21 @@ prod,line=A,station=weld1 temp=81.9,qty=36i 1704067200000000000
##### Partitioning by distinct tag values
| Description | Tag parts | Time part | Resulting partition key |
| Description | Tag parts | Time part | Resulting partition key |
| :---------------------- | :---------------- | :--------- | :----------------------- |
| By day (default) | | `%Y-%m-%d` | 2024-01-01 |
| By day (non-default) | | `%d %b %Y` | 01 Jan 2024 |
| By week | | `%Y wk:%W` | 2024 wk:01 |
| By month | | `%Y-%m` | 2024-01 |
| Single tag, by day | `line` | `%F` | A \| 2024-01-01 |
| Single tag, by week | `line` | `%Y wk:%W` | A \| 2024 wk:01 |
| By year | | `%Y` | 2024 |
| Single tag, by day | `line` | `%Y-%m-%d` | A \| 2024-01-01 |
| Single tag, by month | `line` | `%Y-%m` | A \| 2024-01 |
| Multiple tags, by day | `line`, `station` | `%F` | A \| weld1 \| 2024-01-01 |
| Multiple tags, by week | `line`, `station` | `%Y wk:%W` | A \| weld1 \| 2024 wk:01 |
| Single tag, by year | `line` | `%Y` | A \| 2024 |
| Multiple tags, by day | `line`, `station` | `%Y-%m-%d` | A \| weld1 \| 2024-01-01 |
| Multiple tags, by month | `line`, `station` | `%Y-%m` | A \| weld1 \| 2024-01 |
| Multiple tags, by year | `line`, `station` | `%Y` | A \| weld1 \| 2024 |
##### Partition by tag buckets
| Description | Tag part | Tag bucket part | Time part | Resulting partition key |
| :--------------------------------- | :------- | :-------------- | :--------- | :---------------------- |
| Distinct tag, tag buckets, by day | `line` | `station,100` | `%F` | A \| 3 \| 2024-01-01 |
| Distinct tag, tag buckets, by week | `line` | `station,500` | `%Y wk:%W` | A \| 303 \| 2024 wk:01 |
| Description | Tag part | Tag bucket part | Time part | Resulting partition key |
| :---------------------------------- | :------- | :-------------- | :--------- | :---------------------- |
| Distinct tag, tag buckets, by day | `line` | `station,100` | `%Y-%m-%d` | A \| 3 \| 2024-01-01 |
| Distinct tag, tag buckets, by month | `line` | `station,500` | `%Y-%m` | A \| 303 \| 2024-01 |

View File

@ -39,11 +39,6 @@ and only 1 time part.
- [Tag part templates](#tag-part-templates)
- [Tag bucket part templates](#tag-bucket-part-templates)
- [Time part templates](#time-part-templates)
- [Date specifiers](#date-specifiers)
- [Time specifiers](#time-specifiers)
- [Time zone specifiers](#time-zone-specifiers)
- [Date and time specifiers](#date-and-time-specifiers)
- [Special specifiers](#special-specifiers)
<!-- /TOC -->
## Restrictions
@ -109,175 +104,16 @@ unknown number of distinct values.
## Time part templates
Time part templates use [Rust strftime date and time formatting syntax](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
Time part templates use a limited subset of the
[Rust strftime date and time formatting syntax](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
to specify time format in partition keys.
The smallest unit of time included in the time part template is the interval
used to partition data.
{{% warn %}}
#### Avoid partitioning by less than one day
We do not recommend using time intervals less than one day to partition data.
This can result in [over-partitioned data](/influxdb/clustered/admin/custom-partitions/best-practices/#avoid-over-partitioning)
and may hurt query performance.
{{% /warn %}}
- [Date specifiers](#date-specifiers)
- [Time specifiers](#time-specifiers)
- [Time zone specifiers](#time-zone-specifiers)
- [Date and time specifiers](#date-and-time-specifiers)
- [Special specifiers](#special-specifiers)
{{% note %}}
The following is adapted from the
[Rust strftime source code](https://docs.rs/chrono/latest/src/chrono/format/strftime.rs.html).
{{% /note %}}
InfluxDB uses the smallest unit of time included in the time part template as
the partition interval.
### Date specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `%Y` | `2001` | The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143. Note: years before 1 BCE or after 9999 CE, require an initial sign (+/-). |
| `%C` | `20` | The proleptic Gregorian year divided by 100, zero-padded to 2 digits. [^1] |
| `%y` | `01` | The proleptic Gregorian year modulo 100, zero-padded to 2 digits. [^1] |
| `%m` | `07` | Month number (01--12), zero-padded to 2 digits. |
| `%b` | `Jul` | Abbreviated month name. Always 3 letters. |
| `%B` | `July` | Full month name. Also accepts corresponding abbreviation in parsing. |
| `%h` | `Jul` | Same as `%b`. |
| `%d` | `08` | Day number (01--31), zero-padded to 2 digits. |
| `%e` | ` 8` | Same as `%d` but space-padded. Same as `%_d`. |
| `%a` | `Sun` | Abbreviated weekday name. Always 3 letters. |
| `%A` | `Sunday` | Full weekday name. Also accepts corresponding abbreviation in parsing. |
| `%w` | `0` | Sunday = 0, Monday = 1, ..., Saturday = 6. |
| `%u` | `7` | Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601) |
| `%U` | `28` | Week number starting with Sunday (00--53), zero-padded to 2 digits. [^2] |
| `%W` | `27` | Same as `%U`, but week 1 starts with the first Monday in that year instead. |
| `%G` | `2001` | Same as `%Y` but uses the year number in ISO 8601 week date. [^3] |
| `%g` | `01` | Same as `%y` but uses the year number in ISO 8601 week date. [^3] |
| `%V` | `27` | Same as `%U` but uses the week number in ISO 8601 week date (01--53). [^3] |
| `%j` | `189` | Day of the year (001--366), zero-padded to 3 digits. |
| `%D` | `07/08/01` | Month-day-year format. Same as `%m/%d/%y`. |
| `%x` | `07/08/01` | Locale's date representation (e.g., 12/31/99). |
| `%F` | `2001-07-08` | Year-month-day format (ISO 8601). Same as `%Y-%m-%d`. |
| `%v` | ` 8-Jul-2001` | Day-month-year format. Same as `%e-%b-%Y`. |
### Time specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
| `%H` | `00` | Hour number (00--23), zero-padded to 2 digits. |
| `%k` | ` 0` | Same as `%H` but space-padded. Same as `%_H`. |
| `%I` | `12` | Hour number in 12-hour clocks (01--12), zero-padded to 2 digits. |
| `%l` | `12` | Same as `%I` but space-padded. Same as `%_I`. |
| `%P` | `am` | `am` or `pm` in 12-hour clocks. |
| `%p` | `AM` | `AM` or `PM` in 12-hour clocks. |
| `%M` | `34` | Minute number (00--59), zero-padded to 2 digits. |
| `%S` | `60` | Second number (00--60), zero-padded to 2 digits. [^4] |
| `%f` | `26490000` | Number of nanoseconds since last whole second. [^7] |
| `%.f` | `.026490` | Decimal fraction of a second. Consumes the leading dot. [^7] |
| `%.3f` | `.026` | Decimal fraction of a second with a fixed length of 3. |
| `%.6f` | `.026490` | Decimal fraction of a second with a fixed length of 6. |
| `%.9f` | `.026490000` | Decimal fraction of a second with a fixed length of 9. |
| `%3f` | `026` | Decimal fraction of a second like `%.3f` but without the leading dot. |
| `%6f` | `026490` | Decimal fraction of a second like `%.6f` but without the leading dot. |
| `%9f` | `026490000` | Decimal fraction of a second like `%.9f` but without the leading dot. |
| `%R` | `00:34` | Hour-minute format. Same as `%H:%M`. |
| `%T` | `00:34:60` | Hour-minute-second format. Same as `%H:%M:%S`. |
| `%X` | `00:34:60` | Locale's time representation (e.g., 23:13:48). |
| `%r` | `12:34:60 AM` | Locale's 12 hour clock time. (e.g., 11:11:04 PM). Falls back to `%X` if the locale does not have a 12 hour clock format. |
### Time zone specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :----------------------------------------------------------------------------------------------------------------- |
| `%Z` | `ACST` | Local time zone name. Skips all non-whitespace characters during parsing. Identical to `%:z` when formatting. [^8] |
| `%z` | `+0930` | Offset from the local time to UTC (with UTC being `+0000`). |
| `%:z` | `+09:30` | Same as `%z` but with a colon. |
| `%::z` | `+09:30:00` | Offset from the local time to UTC with seconds. |
| `%:::z` | `+09` | Offset from the local time to UTC without minutes. |
| `%#z` | `+09` | *Parsing only:* Same as `%z` but allows minutes to be missing or present. |
### Date and time specifiers
| Variable | Example | Description |
| :------: | :--------------------------------- | :--------------------------------------------------------------------- |
| `%c` | `Sun Jul 8 00:34:60 2001` | Locale's date and time (e.g., Thu Mar 3 23:05:25 2005). |
| `%+` | `2001-07-08T00:34:60.026490+09:30` | ISO 8601 / RFC 3339 date & time format. [^5] |
| `%s` | `994518299` | UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. [^6] |
### Special specifiers
| Variable | Example | Description |
| :------: | :------ | :---------------------- |
| `%t` | | Literal tab (`\t`). |
| `%n` | | Literal newline (`\n`). |
| `%%` | | Literal percent sign. |
It is possible to override the default padding behavior of numeric specifiers `%?`.
This is not allowed for other specifiers and results in the `BAD_FORMAT` error.
Modifier | Description
-------- | -----------
`%-?` | Suppresses any padding including spaces and zeroes. (e.g. `%j` = `012`, `%-j` = `12`)
`%_?` | Uses spaces as a padding. (e.g. `%j` = `012`, `%_j` = ` 12`)
`%0?` | Uses zeroes as a padding. (e.g. `%e` = ` 9`, `%0e` = `09`)
Notes:
[^1]: `%C`, `%y`:
This is floor division, so 100 BCE (year number -99) will print `-1` and `99` respectively.
[^2]: `%U`:
Week 1 starts with the first Sunday in that year.
It is possible to have week 0 for days before the first Sunday.
[^3]: `%G`, `%g`, `%V`:
Week 1 is the first week with at least 4 days in that year.
Week 0 does not exist, so this should be used with `%G` or `%g`.
[^4]: `%S`:
It accounts for leap seconds, so `60` is possible.
[^5]: `%+`: Same as `%Y-%m-%dT%H:%M:%S%.f%:z`, i.e. 0, 3, 6 or 9 fractional
digits for seconds and colons in the time zone offset.
<br>
<br>
This format also supports having a `Z` or `UTC` in place of `%:z`. They
are equivalent to `+00:00`.
<br>
<br>
Note that all `T`, `Z`, and `UTC` are parsed case-insensitively.
<br>
<br>
The typical `strftime` implementations have different (and locale-dependent)
formats for this specifier. While Chrono's format for `%+` is far more
stable, it is best to avoid this specifier if you want to control the exact
output.
[^6]: `%s`:
This is not padded and can be negative.
For the purpose of Chrono, it only accounts for non-leap seconds
so it slightly differs from ISO C `strftime` behavior.
[^7]: `%f`, `%.f`:
<br>
`%f` and `%.f` are notably different formatting specifiers.<br>
`%f` counts the number of nanoseconds since the last whole second, while `%.f` is a fraction of a
second.<br>
Example: 7μs is formatted as `7000` with `%f`, and formatted as `.000007` with `%.f`.
[^8]: `%Z`:
Since `chrono` is not aware of timezones beyond their offsets, this specifier
**only prints the offset** when used for formatting. The timezone abbreviation
will NOT be printed. See [this issue](https://github.com/chronotope/chrono/issues/960)
for more information.
<br>
<br>
Offset will not be populated from the parsed data, nor will it be validated.
Timezone is completely ignored. Similar to the glibc `strptime` treatment of
this format code.
<br>
<br>
It is not possible to reliably convert from an abbreviation to an offset,
for example CDT can mean either Central Daylight Time (North America) or
China Daylight Time.
*/
| Variable | Example | Description |
| :------: | :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `%Y` | `2001` | The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143. Note: years before 1 BCE or after 9999 CE, require an initial sign (+/-). |
| `%m` | `07` | Month number (01--12), zero-padded to 2 digits. |
| `%d` | `08` | Day number (01--31), zero-padded to 2 digits. |

View File

@ -0,0 +1,199 @@
---
title: View partition information
description: >
Query partition information from InfluxDB v3 system tables to view partition
templates and verify partitions are working as intended.
menu:
influxdb_clustered:
name: View partitions
parent: Manage data partitioning
weight: 202
list_code_example: |
```sql
SELECT * FROM system.partitions WHERE table_name = 'example-table'
```
related:
- /influxdb/clustered/admin/query-system-data/
---
{{< product-name >}} stores partition information in InfluxDB v3 system tables.
Query partition information to view partition templates and verify partitions
are working as intended.
- [Query partition information from system tables](#query-partition-information-from-system-tables)
- [Partition-related queries](#partition-related-queries)
{{% warn %}}
#### Querying system tables may impact overall cluster performance
Partition information is stored in InfluxDB v3 system tables.
Querying system tables may impact the overall write and query performance of
your {{< product-name omit=" Clustered" >}} cluster.
<!--------------- UPDATE THE DATE BELOW AS EXAMPLES ARE UPDATED --------------->
#### System tables are subject to change
System tables are not part of InfluxDB's stable API and may change with new releases.
The provided schema information and query examples are valid as of **August 22, 2024**.
If you detect a schema change or a non-functioning query example, please
[submit an issue](https://github.com/influxdata/docs-v2/issues/new/choose).
<!--------------- UPDATE THE DATE ABOVE AS EXAMPLES ARE UPDATED --------------->
{{% /warn %}}
## Query partition information from system tables
Use the [`influxctl query` command](/influxdb/clustered/reference/cli/influxctl/query/)
and SQL to query partition-related information from InfluxDB system tables.
Provide the following:
- **Enable system tables** with the `--enable-system-tables` command flag.
- **Database token**: A [database token](/influxdb/clustered/admin/tokens/#database-tokens)
with read permissions on the specified database. Uses the `token` setting from
the [`influxctl` connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles)
or the `--token` command flag.
- **Database name**: The name of the database to query information about.
Uses the `database` setting from the
[`influxctl` connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles)
or the `--database` command flag.
- **SQL query**: The SQL query to execute.
Pass the query in one of the following ways:
- a string on the command line
- a path to a file that contains the query
- a single dash (`-`) to read the query from stdin
{{% code-placeholders "DATABASE_(TOKEN|NAME)|SQL_QUERY" %}}
<!--pytest.mark.skip-->
```bash
influxctl query \
--enable-system-tables \
--database DATABASE_NAME \
--token DATABASE_TOKEN \
"SQL_QUERY"
```
{{% /code-placeholders %}}
Replace the following:
- {{% code-placeholder-key %}}`DATABASE_TOKEN`{{% /code-placeholder-key %}}:
A database token with read access to the specified database
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
The name of the database to query information about.
- {{% code-placeholder-key %}}`SQL_QUERY`{{% /code-placeholder-key %}}:
The SQL query to execute. For examples, see
[System query examples](#system-query-examples).
When prompted, enter `y` to acknowledge the potential impact querying system
tables may have on your cluster.
## Partition-related queries
Use the following queries to return information about partitions in your
{{< product-name omit=" Clustered" >}} cluster.
- [View partition templates of all tables](#view-partition-templates-of-all-tables)
- [View the partition template of a specific table](#view-the-partition-template-of-a-specific-table)
- [View all partitions for a table](#view-all-partitions-for-a-table)
- [View the number of partitions per table](#view-the-number-of-partitions-per-table)
- [View the number of partitions for a specific table](#view-the-number-of-partitions-for-a-specific-table)
---
In the examples below, replace {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}
with the name of the table you want to query information about.
---
{{% code-placeholders "TABLE_NAME" %}}
### View partition templates of all tables
```sql
SELECT * FROM system.tables
```
#### Example results
| table_name | partition_template |
| :--------- | :--------------------------------------------------------------------------------------- |
| weather | {"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]} |
| home | {"parts":[{"timeFormat":"%Y-%m-%d"},{"tagValue":"room"},{"tagValue":"sensor_id"}]} |
| numbers | {"parts":[{"timeFormat":"%Y"}]} |
{{% note %}}
If a table doesn't include a partition template in the output of this command,
the tables uses the default partition strategy of one day and does not partition
by tags or tag buckets.
{{% /note %}}
### View the partition template of a specific table
```sql
SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'
```
#### Example results
| table_name | partition_template |
| :--------- | :--------------------------------------------------------------------------------------- |
| weather | {"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]} |
### View all partitions for a table
```sql
SELECT * FROM system.partitions WHERE table_name = 'TABLE_NAME'
```
### Example results
| partition_id | table_name | partition_key | last_new_file_created_at | num_files | total_size_mb |
| -----------: | :--------- | :---------------- | -----------------------: | --------: | ------------: |
| 1362 | weather | 43 \| 2020-05-27 | 1683747418763813713 | 1 | 0 |
| 800 | weather | 234 \| 2021-08-02 | 1683747421899400796 | 1 | 0 |
| 630 | weather | 325 \| 2022-03-17 | 1683747417616689036 | 1 | 0 |
| 1401 | weather | 12 \| 2021-01-09 | 1683747417786122295 | 1 | 0 |
| 1012 | weather | 115 \| 2022-07-04 | 1683747417614219148 | 1 | 0 |
### View the number of partitions per table
```sql
SELECT
table_name,
COUNT(*) AS partition_count
FROM
system.partitions
GROUP BY
table_name
```
### Example results
| table_name | partition_count |
| :--------- | --------------: |
| weather | 1096 |
| home | 24 |
| numbers | 1 |
### View the number of partitions for a specific table
```sql
SELECT
COUNT(*) AS partition_count
FROM
system.partitions
WHERE
table_name = 'TABLE_NAME'
```
### Example results
| table_name | partition_count |
| :--------- | --------------: |
| weather | 1096 |
{{% /code-placeholders %}}

View File

@ -230,9 +230,9 @@ Use the `--template-tag`, `--template-tag-bucket, and `--template-timeformat`
flags to define partition template parts used to generate partition keys for the database.
For more information, see [Manage data partitioning](/influxdb/clustered/admin/custom-partitions/).
{{% note %}}
{{% warn %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a database.
You can't update a partition template on an existing database.
{{% /note %}}
{{% /warn %}}

View File

@ -71,9 +71,9 @@ If no template flags are provided, the table uses the partition template of the
target database.
For more information, see [Manage data partitioning](/influxdb/clustered/admin/custom-partitions/).
{{% note %}}
{{% warn %}}
#### Partition templates can only be applied on create
You can only apply a partition template when creating a table.
There is no way to update a partition template on an existing table.
{{% /note %}}
{{% /warn %}}

View File

@ -155,8 +155,8 @@ influxctl database create \
### Create a database with a custom partition template
The following example creates a new `mydb` database and applies a partition
template that partitions by two tags (`room` and `sensor-type`) and by week using
the time format `%Y wk:%W`:
template that partitions by two tags (`room` and `sensor-type`) and by day using
the time format `%d-%m-%Y`:
<!--Skip tests for database create and delete: namespaces aren't reusable-->
<!--pytest.mark.skip-->
@ -166,7 +166,7 @@ influxctl database create \
--template-tag room \
--template-tag sensor-type \
--template-tag-bucket customerID,1000 \
--template-timeformat '%Y wk:%W' \
--template-timeformat '%d-%m-%Y' \
mydb
```

View File

@ -82,8 +82,8 @@ influxctl table create DATABASE_NAME TABLE_NAME
### Create a table with a custom partition template
The following example creates a new table and applies a partition
template that partitions by two tags (`room` and `sensor-type`) and by week using
the time format `%Y wk:%W`:
template that partitions by two tags (`room` and `sensor-type`) and by day using
the time format `%d-%m-%Y`:
{{% code-placeholders "(DATABASE|TABLE)_NAME" %}}
```sh
@ -91,7 +91,7 @@ influxctl table create \
--template-tag room \
--template-tag sensor-type \
--template-tag-bucket customerID,1000 \
--template-timeformat '%Y wk:%W' \
--template-timeformat '%d-%m-%Y' \
DATABASE_NAME \
TABLE_NAME
```