Thursday, June 14, 2018

Databases: UUID as an ID

Output UUID in Go as a short string - Stack Overflow

example:
hex encoded, 36 chars: 123e4567-e89b-12d3-a456-426655440000

base64 encoded, 22 chars: Ej5FZ-ibEtOkVkJmVUQAAA

GoLang:
import "github.com/satori/go.uuid"
import "encoding/base64"
...
uid, err := uuid.NewV4()
base64.RawURLEncoding.EncodeToString(uid[:])
"base64.RawURLEncoding produces a base64 string (without padding) which is safe for URL inclusion, because the 2 extra chars in the symbol table (beyond [0-9a-zA-Z]) are - and _, both which are safe to be included in URLs"

Store UUID in an optimized way

UUID performance in MySQL? - Stack Overflow

MySQL GUID/UUID Performance Breakthrough

MySQL InnoDB Primary Key Choice: GUID/UUID vs Integer Insert Performance :: KCCoder

No comments: