Tens of millions to hundreds of millions of data records
Device ID table sharding, by segment or modulo
Primary Key with long time
Finally, remove the auto-incrementing column.
If the concurrency exceeds a certain level (for example, 100 times per second)
Read/write splitting starts.
Primary database with no index write only
Create an index from the database and adjust the index size
If the concurrency is large (for example, writing-times per second or more), this is the case:
Raw data is stored using aof log
And then asynchronously stored in the database
Database re-read/write splitting
After writing logs, multiple workers write data to the database concurrently, almost instantly.
To put it bluntly, the key to a system of this scale is indexing.
Using relational databases is a fast and cost-effective index system.
Data archiving should also be done. cold/hot data is separated, and old data is merged according to different dimensions.