Merge pull request #5611 from influxdata/chunchun/system-table-filters

fix(v3): add filters on more system table examples
pull/5615/head
Jason Stirnaman 2024-09-24 16:45:11 -05:00 committed by GitHub
commit 4f2262a1ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 48 deletions

View File

@ -35,7 +35,7 @@ your {{< product-name omit=" Clustered" >}} cluster.
#### System tables are subject to change #### System tables are subject to change
System tables are not part of InfluxDB's stable API and may change with new releases. 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**. The provided schema information and query examples are valid as of **September 24, 2024**.
If you detect a schema change or a non-functioning query example, please 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). [submit an issue](https://github.com/influxdata/docs-v2/issues/new/choose).
@ -108,27 +108,7 @@ with the name of the table you want to query information about.
--- ---
{{% code-placeholders "TABLE_NAME" %}} {{% code-placeholders "TABLE_NAME_(1|2|3)|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 table uses the default (1 day) partition strategy and doesn't partition
by tags or tag buckets.
{{% /note %}}
### View the partition template of a specific table ### View the partition template of a specific table
@ -142,6 +122,12 @@ SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'
| :--------- | :----------------------------------------------------------------------------------------- | | :--------- | :----------------------------------------------------------------------------------------- |
| weather | `{"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]}` | | weather | `{"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]}` |
{{% note %}}
If a table doesn't include a partition template in the output of this command,
the table uses the default (1 day) partition strategy and doesn't partition
by tags or tag buckets.
{{% /note %}}
### View all partitions for a table ### View all partitions for a table
```sql ```sql
@ -166,6 +152,8 @@ SELECT
COUNT(*) AS partition_count COUNT(*) AS partition_count
FROM FROM
system.partitions system.partitions
WHERE
table_name IN ('TABLE_NAME_1', 'TABLE_NAME_2', 'TABLE_NAME_3')
GROUP BY GROUP BY
table_name table_name
``` ```

View File

@ -420,7 +420,7 @@ Querying system tables can impact the overall performance of your
InfluxDB's stable API and are subject to change. InfluxDB's stable API and are subject to change.
{{% /warn %}} {{% /warn %}}
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}} {{% code-placeholders "DATABASE_(TOKEN|NAME)|TABLE_NAME" %}}
{{< code-tabs-wrapper >}} {{< code-tabs-wrapper >}}
{{% code-tabs %}} {{% code-tabs %}}
@ -435,7 +435,7 @@ influxctl query \
--enable-system-tables \ --enable-system-tables \
--token DATABASE_TOKEN \ --token DATABASE_TOKEN \
--database DATABASE_NAME \ --database DATABASE_NAME \
"SELECT * FROM system.tables" "SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'"
``` ```
{{% /influxdb/custom-timestamps %}} {{% /influxdb/custom-timestamps %}}
{{% /code-tab-content %}} {{% /code-tab-content %}}

View File

@ -35,7 +35,7 @@ your {{< product-name omit=" Clustered" >}} cluster.
#### System tables are subject to change #### System tables are subject to change
System tables are not part of InfluxDB's stable API and may change with new releases. 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**. The provided schema information and query examples are valid as of **September 24, 2024**.
If you detect a schema change or a non-functioning query example, please 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). [submit an issue](https://github.com/influxdata/docs-v2/issues/new/choose).
@ -108,27 +108,7 @@ with the name of the table you want to query information about.
--- ---
{{% code-placeholders "TABLE_NAME" %}} {{% code-placeholders "TABLE_NAME_(1|2|3)|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 table uses the default (1 day) partition strategy and doesn't partition
by tags or tag buckets.
{{% /note %}}
### View the partition template of a specific table ### View the partition template of a specific table
@ -142,6 +122,12 @@ SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'
| :--------- | :----------------------------------------------------------------------------------------- | | :--------- | :----------------------------------------------------------------------------------------- |
| weather | `{"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]}` | | weather | `{"parts":[{"timeFormat":"%Y-%m-%d"},{"bucket":{"tagName":"location","numBuckets":250}}]}` |
{{% note %}}
If a table doesn't include a partition template in the output of this command,
the table uses the default (1 day) partition strategy and doesn't partition
by tags or tag buckets.
{{% /note %}}
### View all partitions for a table ### View all partitions for a table
```sql ```sql
@ -166,6 +152,8 @@ SELECT
COUNT(*) AS partition_count COUNT(*) AS partition_count
FROM FROM
system.partitions system.partitions
WHERE
table_name IN ('TABLE_NAME_1', 'TABLE_NAME_2', 'TABLE_NAME_3')
GROUP BY GROUP BY
table_name table_name
``` ```

View File

@ -418,7 +418,7 @@ Querying system tables can impact the overall performance of your
InfluxDB's stable API and are subject to change. InfluxDB's stable API and are subject to change.
{{% /warn %}} {{% /warn %}}
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}} {{% code-placeholders "DATABASE_(TOKEN|NAME)|TABLE_NAME" %}}
{{< code-tabs-wrapper >}} {{< code-tabs-wrapper >}}
{{% code-tabs %}} {{% code-tabs %}}
@ -433,7 +433,7 @@ influxctl query \
--enable-system-tables \ --enable-system-tables \
--token DATABASE_TOKEN \ --token DATABASE_TOKEN \
--database DATABASE_NAME \ --database DATABASE_NAME \
"SELECT * FROM system.tables" "SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'"
``` ```
{{% /influxdb/custom-timestamps %}} {{% /influxdb/custom-timestamps %}}
{{% /code-tab-content %}} {{% /code-tab-content %}}