Today I have decided to take a look at the redesign of the Medieval Realms database. This is the first production database I’ve ever written. It’s ugly. It’s not really relational. And it’s bloated to 34 tables. This database has grown organically since 2017 and without implementing any ALTER TABLE syntax. I’ve learned a lot since then. Here are today’s learnings.
TIMESTAMP(0) vs TIMESTAMP(6)
TIMESTAMP(0)
This datatype flavour of TIMESTAMP holds the current time as YYYY-MM-DDbHH:MI:SS
Taking up CHAR(19) space
TIMESTAMP(6)
This datatype flavour of TIMESTAMP holds the current time more precisely as Timestamp(6) is YYYY-MM-DDbHH:MI:SS.ssssss
In other words it also includes milliseconds.
Taking up CHAR(26) space
Conclusion. If milliseconds are not needed use TIMESTAMP(0) aka TIMESTAMP. If milliseconds are a requirement use the larger datatype of TIMESTAMP(6).