Jaffa Cakes :
My application records status changes in discord. (Online, offline, idle and DND) This is achieved using discord.py and an SQL server (MariaDB).
Specifically, if I receive hundreds of of status updates per second (all with the same Unix timestamp since they happened within a second of each other), should I Store each Unix timestamp in a separate table with an ID for each?
I am asking this question in hopes of saving disk space in the long run.
My hypothesis is that if a smaller number is stored with less digits (the ID that points to a timestamp), it would take up less space as the large Unix timestamp wouldn't need to be repeated hundreds of times.
WayToDoor :
A few questions/remarks are raised by your post...
- Do you really need to store timestamps with up-to-the-second accuracy ? SToring with a bigger interval would mean less space usage.
- You could use a smaller int to store timestamps with an epoch closer to the present, so you could use less space overall, without needing a new table.
- You should maybe consider dropping events that happen too frequently. If a user change status 10 times in a minute, maybe it's not worth it recording them all ?
- Finaly, an enum (smallint) and a timestamp is not that big in a database. They can usualy handle thousand of gigabytes "just fine"
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=398723&siteId=1