Hacker News new | ask | show | jobs
by function_seven 1286 days ago
Doesn't numeric storage save space and make indexing faster? (This is a naive question, I'm not asserting it.)

Yeah, numbers get you fun stuff like overflows and wrap-arounds, etc. But sorting is faster (sorting "99" before "100" is more complex than 99 before 100) and space requirement is lower (6 bytes can store a unique ID for 281 trillion objects, but 6 characters only permits 1 million if you're storing them as strings).

Or is there some datatype that combines the space- and sort-efficiency of a numeric type, but doesn't bring the baggage of assuming they represent quantities?

1 comments

XID wraparound is one of the things that makes me wish Postgres would go 64bit on some of their internal data structures.