Interval-Based Time Range Sharding Algorithm
Module
Since 4.0 the sharding algorithms are in their own artifact, me.ahoo.cosid:cosid-sharding (package me.ahoo.cosid.sharding, unchanged).

- Algorithm complexity: O(1)
- Usability: Supports multiple data types (
Long/LocalDateTime/DATE/String/SnowflakeId), while the official implementation converts to string first then toLocalDateTime, success rate affected by time formatting characters. - Performance: Compared to
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm, performance is 1200~4000 times higher.
| PreciseShardingValue | RangeShardingValue |
|---|---|
![]() | ![]() |


