Bytes represent binary content as a sequence of byte values. In API and database design, choosing byte-based storage affects allocation, identifier size, indexing, and compatibility. section 5.4.1 section 6.4.5
Use raw bytes when the underlying system handles binary identifiers efficiently, but compare the main storage alternatives:
- Store an identifier as raw bytes when the database supports binary fields, uniqueness constraints, and indexed single-key lookups. section 6.4.5
- Use a string representation when simplicity and customer-facing readability matter, while recognizing that encoded strings consume more space. section 6.4.5
- Convert the bytes to an integer when the identifier fits a common 32- or 64-bit type; this usually offers the broadest database support. section 6.4.5
Binary identifier storage
For a database that indexes binary values well, store an identifier using a raw-bytes field such as MySQL BINARY. Enforce uniqueness and add an index for fast single-key lookups. section 6.4.5






