4 ms·
As a sibling comment said, optimizing for size. However, since in ut8mb4 (the standard for Postgres, and modern MySQL) each char may take up to 4 bytes to store
by sgarland 3y ago
As a sibling comment said, optimizing for size. However, since in ut8mb4 (the standard for Postgres, and modern MySQL) each char may take up to 4 bytes to store, the updated version of this would be VARCHAR(63).
If you can guarantee you’ll only store ASCII, you can safely use 255.
This is also probably a premature optimization for practically anyone to be fair. Even at 1 billion rows, you’ve only added 1 GiB of overhead, and at that scale that’s a small percentage of the overall size.