Reasons for bigint datatype in wordpress id columns
-
(Posted this in the wrong sub forum first, sorry. Should be deleted there.)
I’m still getting into the WordPress framework, developing my first “real” Plugin and while thinking about my table structure couldn’t help to notice that all WordPress core tables use bigint as datatype for any id column.
I’m wondering if anyone knows the reasoning behind this. For comments or post it may make sense, but for users? If a platform is expected to exceed 4 Billion users I doubt that WordPress will be the software of choice.
The only possible argument I can imagine would be performance benefits from using uniformly sized primary keys throughout the database. But that’s just a very weak guess, because honestly I have no clue about the inner workings of any particular DBMS.
Why is it “bothering” me? If the usually sufficient int type would be used the fields would only require 4 Bytes of storage instead of 8. What’s 4 Bytes? Imagine a big WordPress instance with 10 Million comments. Just looking at them that’s id and post id, parent comment and author id (default to 0), per comment. So 10M*4*4B makes 160MB of wasted space.
It’s still not a big number for current storage solutions but together with the other unnecessarily big fields it accumulates over the entire database. I just find it strange that it’s the default setup for a largely distributed CMS. Seems like a needless waste of resources. Because I would hazard the guess that 99% of all WordPress installations will never accumulate even close to 4 Billion rows in any of their core tables.
I realize this comes off like a rant, but I’m really interested to know if there are any good reasons for this design decision. If anybody has more insight to it, sharing would be much appreciated!
- The topic ‘Reasons for bigint datatype in wordpress id columns’ is closed to new replies.