Re:Implementing Stripe-Like Idempotency Keys in Postgres
by Dowwie on Friday October 27, 2017 @01:46PM
(#15570613)
Snowflake id is a BIGINT. How does it contrast from UUID, other than joining faster?
[ Parent
| on HN ]
Re:Implementing Stripe-Like Idempotency Keys in Postgres
by grzm on Friday October 27, 2017 @01:59PM
(#15570734)
Trivially, a UUID is wider (128 bits as opposed to 64). You can choose to generate your UUIDs using a Instragram[0]-like strategy so you can, for example, benefit from temporal/spatial locality in the indexes. There may be performance consequences of using the wider datatype, but I suspect this could be overwhelmed by other application concerns if you're dealing with data that benefits from the wider type.
[0] https://engineering.instagram.com/sharding-ids-at-instagram-...
Edit: Update to correct snowflake to Instagram's strategy. I make this mistake often enough that it's now self-reinforcing :/
Re:Implementing Stripe-Like Idempotency Keys in Postgres
by Dowwie on Friday October 27, 2017 @02:20PM
(#15570920)
So you are presumably agreeing that snowflake makes sense?
Re:Implementing Stripe-Like Idempotency Keys in Postgres
by grzm on Friday October 27, 2017 @02:28PM
(#15570974)
Oh, of course! Depending on your application needs, it certainly can work. The benefit of PostgreSQL UUID is that you effectively have twice the bits, so you have more room to encode data and satisfy your uniqueness guarantees.