hanakoa / alpaca

Containerized Go µServices for authentication and authorization.
https://hanakoa.github.io/alpaca/
MIT License
5 stars 0 forks source link

API: CockroachDB #58

Open kevinmichaelchen opened 6 years ago

kevinmichaelchen commented 6 years ago

CockroachDB is a cloud-native SQL database for building global, scalable cloud services that survive disasters... a distributed SQL database built on a transactional and strongly-consistent key-value store. It scales horizontally; survives disk, machine, rack, and even datacenter failures with minimal latency disruption and no manual intervention; supports strongly-consistent ACID transactions; and provides a familiar SQL API for structuring, manipulating, and querying data.

CockroachDB can easily be swapped for Postgres using the pq driver.

https://www.cockroachlabs.com/docs/stable/build-a-go-app-with-cockroachdb.html

kevinmichaelchen commented 6 years ago

Are Snowflakes still a good idea in the context of a distributed DB?

Per this thread (https://news.ycombinator.com/item?id=14523523):

in a distributed database like CockroachDB (Disclosure: I'm the co-founder and CTO of Cockroach Labs) or Google Cloud Spanner, it's usually better to get the random scattering of a UUID primary key, because that spreads the workload across all the nodes in the cluster. Sometimes query patterns benefit enough from an ordered PK to overcome this advantage, but usually it's better to use randomly-distributed PKs by default.