Manage data partitioning
When writing data to InfluxDB Clustered, the InfluxDB 3 storage engine stores data in Apache Parquet format in the Object store. Each Parquet file represents a partition–a logical grouping of data. By default, InfluxDB partitions each table by day. If this default strategy yields unsatisfactory performance for single-series queries, you can define a custom partitioning strategy by specifying tag values and different time intervals to optimize query performance for your specific schema and workload.
- Advantages
- Disadvantages
- Limitations
- Plan for custom partitioning
- How partitioning works
- Partitions in the query life cycle
- Partition guides
When to consider custom partitioning
Consider custom partitioning if:
- You have taken steps to optimize your queries, and
- Performance for single-series queries (querying for a specific tag value or tag set) is still unsatisfactory.
Before choosing a partitioning strategy, weigh the advantages, disadvantages, and limitations of custom partitioning.
Advantages
The primary advantage of custom partitioning is that it lets you customize your storage structure to improve query performance specific to your schema and workload.
- Optimized storage for improved performance on specific types of queries. For example, if queries often select data with a specific tag value, you can partition by that tag to improve the performance of those queries.
- Optimized storage for specific types of data. For example, if the data you store is sparse and the time ranges you query are often much larger than a day, you could partition your data by month instead of by day.
Disadvantages
Using custom partitioning may increase the load on other parts of the InfluxDB 3 storage engine, but you can scale each part individually to address the added load.
The weight of these disadvantages depends upon the cardinality of tags and the specificity of time intervals used for partitioning.
- Increased load on the Ingester as it groups data into smaller partitions and files.
- Increased load on the Catalog as more references to partition Parquet file locations are stored and queried.
- Increased load on the Compactor as it needs to compact more partition Parquet files.
- Increased costs associated with Object storage as more partition Parquet files are created and stored.
- Increased latency. The amount of time for InfluxDB to process a query and return results increases linearly, although slightly, with the total partition count for a table.
- Risk of decreased performance for queries that don’t use tags in the WHERE clause. These queries might read many partitions and smaller files, which can degrade performance.
Limitations
Custom partitioning has the following limitations:
- Define database and table partitions only during creation; you can’t update the partition strategy afterward.
- Include a time part in a partition template.
- You can partition by up to eight dimensions (seven tags and a time interval).
Plan for custom partitioning
After you have considered the advantages, disadvantages, and limitations of custom partitioning, use the guides in this section to:
- Learn how partitioning works
- Follow best practices for defining partitions and managing partition growth
- Define custom partitions for your data
- Take steps to limit the number of partition files
How partitioning works
Partition templates
A partition template defines the pattern used for partition keys and determines the time interval that InfluxDB partitions data by. Partition templates use tag values and Rust strftime date and time formatting syntax.
For more detailed information, see Partition templates.
Partition keys
A partition key uniquely identifies a partition.
A partition template defines the partition key format.
Partition keys are
composed of up to 8 dimensions (1 time part and up to 7 tag or tag bucket parts).
A partition key uses the partition key separator (|
) to delimit parts.
The default format for partition keys is %Y-%m-%d
(for example, 2024-01-01
),
which creates 1 partition for each day.
Partitions in the query life cycle
When querying data:
- The Catalog provides the v3 query engine (Querier) with the locations of partitions that contain the queried time series data.
- The query engine reads all rows in the returned partitions to identify what rows match the logic in the query and should be included in the query result.
The faster the query engine can identify what partitions to read and then read the data in those partitions, the more performant queries are.
For more information about the query lifecycle, see InfluxDB 3 query life cycle.
Query example
Consider the following query that selects everything in the production
table
where the line
tag is A
and the station
tag is cnc
:
SELECT *
FROM production
WHERE
time >= now() - INTERVAL '1 week'
AND line = 'A'
AND station = 'cnc'
Using the default partitioning strategy (by day), the query engine reads eight separate partitions (one partition for today and one for each of the last seven days):
- 2025-01-14
- 2025-01-13
- 2025-01-12
- 2025-01-11
- 2025-01-10
- 2025-01-09
- 2025-01-08
- 2025-01-07
The query engine must scan all rows in the partitions to identify rows
where line
is A
and station
is cnc
. This process takes valuable time
and results in less performant queries.
However, including tags in your partitioning strategy allows the query engine to identify partitions containing only the required tag values. This avoids scanning rows for tag values.
For example, if you partition data by line
, station
, and day, although
the number of files increases, the query engine can quickly identify and read
only those with data relevant to the query:
A | cnc | 2025-01-14
A | wld | 2025-01-14
B | cnc | 2025-01-14
B | wld | 2025-01-14
A | cnc | 2025-01-13
A | wld | 2025-01-13
B | cnc | 2025-01-13
B | wld | 2025-01-13
A | cnc | 2025-01-12
A | wld | 2025-01-12
B | cnc | 2025-01-12
B | wld | 2025-01-12
A | cnc | 2025-01-11
A | wld | 2025-01-11
B | cnc | 2025-01-11
B | wld | 2025-01-11
A | cnc | 2025-01-10
A | wld | 2025-01-10
B | cnc | 2025-01-10
B | wld | 2025-01-10
A | cnc | 2025-01-09
A | wld | 2025-01-09
B | cnc | 2025-01-09
B | wld | 2025-01-09
A | cnc | 2025-01-08
A | wld | 2025-01-08
B | cnc | 2025-01-08
B | wld | 2025-01-08
A | cnc | 2025-01-07
A | wld | 2025-01-07
B | cnc | 2025-01-07
B | wld | 2025-01-07
Partition guides
Define custom partitions
Use the influxctl
CLI to define custom partition strategies when creating a database or table.
Use partition templates
Learn how to define custom partitioning strategies using partition templates. Data can be partitioned by tag and time.
Partitioning best practices
Learn best practices for applying custom partition strategies to your data stored in InfluxDB.
View partition information
Query partition information from InfluxDB 3 system tables to view partition templates and verify partitions are working as intended.
SELECT * FROM system.partitions WHERE table_name = 'example-table'
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB Clustered and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.