If you're ingesting old data, you should try to sort your data by timestamp. This will help to create fewer active partitions.
Then, before inserting the old data into Timestream, you should check the active partitions.
I met with the AWS support team several times to understand the best way to ingest data into the magnetic store (the memory store doesn't have this constraint). They suggested ingesting data sorted by timestamp. So if you have multiple devices, you should ingest the data by timestamp instead of by device.
The criteria behind an active partition is not clear and they always talk about likelihood...
I've run load tests to ingest the same data into the magnetic store and ended up with different numbers of active partitions.
Here are the results of my load tests:
I ingest 2142288 records belonging to January 2022, which it will be written in the magnetic store with my current timestream configuration. Between each execution, I increased the record version to override the previous record.
January (total active partitions: 0)
- Ingest 2142288 records -> new 16 active partitions (new: 16)
- Ingest 2142288 records -> new 16 active partitions (new: 16, total: 32)
- Ingest 2142288 records -> new 16 active partitions (new: 16, total: 48)
- Ingest 2142288 records -> new 0 active partitions (new: 0, total: 48)
- Ingest 2142288 records -> new 0 active partitions (new: 0, total: 48)
Without waiting for the active partitions to drop to zero, I ingested 1922784 records belonging to February 2022.
February(total active partitions: 48)
- Ingest 1922784 records -> new 0 active partitions (new: 0, total:48 )
I waited until active partitions decreased to zero, increased the record version and ran the same tests
February(total active partitions: 0)
- Ingest 1922784 records -> new 82 active partitions (new: 0, total:82)
As you can see, there is no clear pattern regarding the creation of active partitions but if you sorted your data by timestamp you'll get a better likelihood of success while ingesting data into the magnetic store.