this post was submitted on 08 Jul 2023
5 points (77.8% liked)
Programming
17313 readers
483 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Often that's done with two databases - one database is fast to write, the other is fast to read.
Then you have a task that moves data from the fast write database over to the fast read one.
A simple table with no index at all on a fast server with a simple relational database should be able to handle several hundred thousand inserts per second. If you add indexes, it gets slower. Potentially unusably slow.
So, you have all your indexes on a second table. That one does have indexes, and with the right indexes it can handle hundreds of thousands of reads per second.
No scaling necessary, just two tables in one database. You should only need to scale when you run out of disk space.
You might also make it a little more complex, like have a write table for each day. Then you can copy the data over in a single batch and delete the table.
Good ol' read replica pattern.