Why we chose NanoIDs for PlanetScale’s API
Mar 29, 2022Mike Coutermarsh

Summary
This post details the decision to adopt NanoIDs for PlanetScale's API public identifiers. It explains the trade-offs between UUIDs and NanoIDs, focusing on URL length and selectability. The post provides specific implementation details for generating NanoIDs in Ruby on Rails, including schema changes and a shared `concern` for auto-generation with retry logic. It also demonstrates NanoID generation in Go. The collision probability calculation using the NanoID collision tool is presented, along with the chosen alphabet and length for PlanetScale's use case.