Eliezer Talker
10/04/2026, 2:49 PMRocky
10/04/2026, 2:50 PMpartition_live_number property. For example, setting it to 7 will keep only the 7 most recent partitions.
* Manual/Scripted Dropping: You can use ALTER TABLE ... DROP PARTITION.
* S3 Cleanup: In shared-data mode, when a partition is dropped, StarRocks does not just delete metadata. A background process called Vacuum eventually deletes the orphaned data files from S3. To delete data immediately, you can use the FORCE keyword (though usually applied to tables).
2. Fast Access: Keeping Data on Disk "Forever"
Shared-data mode uses a Data Cache (on local BE/CN disks) to provide performance similar to local storage while maintaining the scaling benefits of S3.
* Cache Persistence: Set datacache.enable = "true" (default). To keep data in the cache as long as possible, you can set datacache.partition_duration to a very long time (e.g., 100 YEAR) or leave it empty so all data is treated as "hot."
* Behavior: The data is stored in S3 (source of truth) but cached on local disks. If you scale up/down by adding or removing CN (Compute) nodes, the new nodes will pull data from S3 into their local cache as queries run.
* Warmup: In StarRocks v3.3+, you can use the CACHE SELECT command to proactively "warm up" the local disk cache so that queries are fast immediately after scaling.
3. Multiple Partitions (Multi-column Partitioning)
You can achieve your goal of querying by event_time while dropping by receive_ts using Multi-column Expression Partitioning (supported since v3.1, with expanded support in v3.4+).
How to set it up:
You can partition by both columns. From v3.4 onwards, StarRocks supports mixed expressions where one column can be a time function.
sql
CREATE TABLE my_table (
events_start_time DATETIME,
receive_ts DATETIME,
...
)
PARTITION BY
date_trunc('day', events_start_time),
date_trunc('day', receive_ts)
DISTRIBUTED BY HASH(events_start_time) BUCKETS 10
PROPERTIES (
"datacache.enable" = "true"
);
Handling your scenario:
1. Querying: When you query by events_start_time, StarRocks will use partition pruning to only look at the relevant partitions.
2. Dropping Late Data: Because the partition name includes both values (e.g., p20231001_20231005), you can run a maintenance job (once a day) that identifies and drops partitions where the receive_ts part is older than 7 days.
* Note: Since receive_ts is part of the partition key, late-arriving data for an old event_time will simply go into a new partition with a current receive_ts, which keeps it safe from your 7-day cleanup logic until 7 days after it actually arrived.
Summary of Benefits for Your Case
* Scaling: Use CN nodes for automatic/easy scaling. Since data is in S3, you don't have to worry about the heavy data redistribution (rebalancing) that occurs in non-shared (shared-nothing) mode.
* Performance: The local Data Cache ensures that for your active 7-day window, the data is served directly from the local NVMe/SSD disks of your CN nodes.
* Flexibility: Multi-column partitioning allows you to decouple the "Business Time" (for queries) from the "System Time" (for TTL/Cleanup).
References
• table_design/data_distribution/dynamic_partitioning.md
• table_design/data_distribution/expression_partitioning.mdEliezer Talker
10/04/2026, 3:01 PMRocky
10/04/2026, 3:01 PMsql
CREATE EXTERNAL CATALOG iceberg_catalog
PROPERTIES (
"type" = "iceberg",
"iceberg.catalog.type" = "glue", -- or hive, rest, etc.
"aws.s3.region" = "us-east-1"
);
Step 2: Move the Data (Insert into Iceberg)
StarRocks supports INSERT into Iceberg tables (v3.1+). You can run a daily job to archive data older than 7 days:
sql
INSERT INTO iceberg_catalog.iceberg_db.archived_table
SELECT *
FROM starrocks_db.fast_table
WHERE receive_ts < CURRENT_DATE() - INTERVAL 7 DAY;
Note: This command reads from StarRocks and writes directly to Iceberg in Parquet format.
Step 3: Drop the Old Data from StarRocks
After the move is successful, drop the partitions from StarRocks:
sql
ALTER TABLE starrocks_db.fast_table
DROP PARTITION p20231001;
-- Or use the automated TTL 'partition_live_number' as mentioned before.
Why this fits you:
1. Fast Queries: While data is in StarRocks, it is served from the local NVMe cache of your CN nodes.
2. Scaling: If you have a spike in queries, you can spin up 10 more CN nodes instantly. They will pull data from S3 into their local caches and start helping immediately.
3. Archival: StarRocks acts as the "bridge." It can read its own high-performance format and write to the open Iceberg format seamlessly.
4. No Scaling Pain: In shared-nothing mode, if you added nodes to handle a query spike, you'd have to wait hours for the 7 days of data to "rebalance" to the new nodes. In shared-data, there is zero rebalancing.
References
• deployment/shared_data/feature-support-shared-data.md
• deployment/shared_data/s3.md
• quick_start/shared-data.md