nsg-ethz / autopower

A software suite to conveniently collect, gather, and display power measurement from networking hardware.
MIT License
2 stars 1 forks source link

Investigate server side use of SERIAL and change type to BIGSERIAL if needed #15

Open UsualSpec opened 1 month ago

UsualSpec commented 1 month ago

At the moment, we use SERIAL IDs in the measurement_data relation: https://github.com/nsg-ethz/autopower/blob/956049c2fef02fe1763eb596110164ac253092c1/server/database_schema.sql#L49 Since we will constantly insert data into this table, the md_id will also increment per sample.

SERIAL is a signed 32-Bit INT and could overflow in the far future. Depending on the sampling interval and how many devices are deployed, we could hit the maximum integer value one day. We may want to change to a BIGSERIAL instead.

As reference, see: https://dba.stackexchange.com/questions/47591/should-i-be-concered-by-large-serial-values

UsualSpec commented 1 month ago

BIGSERIAL also needs more space since it's 64-bit. So it is a tradeoff.