Matheus Salvia
03/09/2026, 3:59 PMweek partition granularity is not supported. (link: https://docs.starrocks.io/docs/4.0/table_design/data_distribution/expression_partitioning/)
But it seems to be working nonetheless? or at least failing silently, which would not be good.
I have the following table which seems to be working just fine:
CREATE TABLE IF NOT EXISTS sessions.timeseries_data (
project_id BIGINT,
version_id BIGINT,
user_key_hash BIGINT,
datum_timestamp DATETIME,
... bunch of columns ...
-- Generated partition column: week boundary
datum_week DATE AS DATE(date_trunc('week', datum_timestamp))
)
PRIMARY KEY(project_id, version_id, user_key_hash, datum_timestamp)
PARTITION BY datum_week
DISTRIBUTED BY HASH(user_key_hash) BUCKETS 8
PROPERTIES (
"colocate_with" = "userkey_join_group",
"partition_retention_condition" = "datum_week >= CURRENT_DATE() - INTERVAL 105 DAY",
);
is this a case of documentation being out of date or is it a real limitation and I shouldn't use it?Matheus Salvia
03/09/2026, 4:00 PMCREATE TABLE IF NOT EXISTS sessions.timeseries_data (
project_id BIGINT,
version_id BIGINT,
user_key_hash BIGINT,
datum_timestamp DATETIME,
... bunch of columns ...
)
PRIMARY KEY(project_id, version_id, user_key_hash, datum_timestamp)
PARTITION BY date_trunc('week', datum_timestamp)
DISTRIBUTED BY HASH(user_key_hash) BUCKETS 8biying gao
03/12/2026, 5:01 AMweek partition granularity is not supported. (link: https://docs.starrocks.io/docs/4.0/table_design/data_distribution/expression_partitioning/)
But it seems to be working nonetheless? or at least failing silently, which would not be good.
I have the following table which seems to be working just fine:Rocky
03/12/2026, 5:01 AMdate_trunc or time_slice) often states that week is not supported as a direct time_unit parameter.
2. Why it "works": StarRocks has been evolving quickly. While date_trunc('week', ...) might not have been officially "validated" or optimized for all automated partition management features (like partition_live_number or certain dynamic behaviors) in earlier versions, the underlying engine often handles the function call just fine because date_trunc itself supports 'week'.
3. The Recommended Way for Weekly Partitions: As shown in the examples in our documentation, the officially supported way to achieve weekly partitioning is by using `time_slice`:
sql
PARTITION BY time_slice(column_name, INTERVAL 7 day)
This creates partitions with a 7-day range, which effectively gives you the weekly granularity you're looking for and is fully supported by the system's partition management.
Is it safe to use?
If your table DDL with date_trunc('week', ...) or similar is working, it's likely because the system is treating it as a generic expression partition. However, to ensure full compatibility with all partition management features (like automatic cleanup via TTL) and to follow the "golden path" of the product, we recommend using the time_slice(..., INTERVAL 7 day) approach mentioned above.
I'll make sure to pass this feedback to our documentation team to clear up the "week not supported" vs "Example 3" contradiction! If you can share the specific DDL you used, I can double-check if there are any subtle edge cases you should be aware of.
References
• table_design/data_distribution/expression_partitioning.mdbiying gao
03/12/2026, 5:03 AMtime_unit because a "month" does not necessarily align with full weeks.Matheus Salvia
03/12/2026, 5:00 PMMatheus Salvia
03/12/2026, 5:00 PMweek is supported, it was just the documentation that was outdatedbiying gao
03/12/2026, 5:03 PM