Skip to content

Commit 8c275dc

Browse files
committed
fix(clustered): filter system queries.
1 parent 8859067 commit 8c275dc

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

content/influxdb/clustered/admin/query-system-data.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ WHERE
185185
```
186186
{{% /code-placeholders %}}
187187

188+
{{% code-placeholders "TABLE_NAME|PARTITION_KEY" %}}
189+
```sql
190+
SELECT *
191+
FROM system.compactor
192+
WHERE
193+
table_name = 'TABLE_NAME'
194+
AND partition_key = 'PARTITION_KEY';
195+
```
196+
{{% /code-placeholders %}}
197+
188198
##### Filter by partition ID
189199

190200
When querying the `system.partitions` or `system.compactor` table, use the `WHERE` clause to

content/influxdb/clustered/query-data/troubleshoot-and-optimize/report-query-performance-issues.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,15 @@ If queries are slow for a specific table, run the following system queries to co
351351
- [Collect compaction information for the table](#collect-compaction-information-for-the-table)
352352
- [Collect partition information for multiple tables](#collect-partition-information-for-multiple-tables)
353353

354+
To [optimize system queries](/influxdb/clustered/admin/query-system-data/#optimize-queries-to-reduce-impact-to-your-cluster), use `table_name`, `partition_key`, and
355+
`partition_id` filters.
354356
In your queries, replace the following:
355357

356-
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}: the
357-
table to retrieve information about
358+
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}: the table to retrieve partitions for
359+
- {{% code-placeholder-key %}}`PARTITION_ID`{{% /code-placeholder-key %}}: a [partition ID](/influxdb/clustered/admin/query-system-data/#retrieve-a-partition-id) (int64)
360+
- {{% code-placeholder-key %}}`PARTITION_KEY`{{% /code-placeholder-key %}}: a [partition key](/influxdb/clustered/admin/custom-partitions/#partition-keys)
361+
derived from the table's partition template.
362+
The default format is `%Y-%m-%d` (for example, `2024-01-01`).
358363

359364
#### Collect table information
360365

@@ -368,13 +373,32 @@ WHERE table_name = 'TABLE_NAME';
368373

369374
#### Collect compaction information for the table
370375

371-
{{% code-placeholders "TABLE_NAME" %}}
376+
Query the `system.compactor` table to collect compaction information--for example, run one of the following
377+
queries:
378+
379+
{{% code-placeholders "TABLE_NAME|PARTITION_KEY" %}}
380+
372381
```sql
373-
SELECT *
374-
FROM system.compactor
375-
WHERE table_name = 'TABLE_NAME';
382+
SELECT *
383+
FROM system.compactor
384+
WHERE
385+
table_name = 'TABLE_NAME'
386+
AND partition_key = 'PARTITION_KEY';
376387
```
377-
{{% /code-placeholders%}}
388+
389+
{{% /code-placeholders %}}
390+
391+
{{% code-placeholders "TABLE_NAME|PARTITION_ID" %}}
392+
393+
```sql
394+
SELECT *
395+
FROM system.compactor
396+
WHERE
397+
table_name = 'TABLE_NAME'
398+
AND partition_id = 'PARTITION_ID';
399+
```
400+
401+
{{% /code-placeholders %}}
378402

379403
#### Collect partition information for multiple tables
380404

0 commit comments

Comments
 (0)