Giter Club home page Giter Club logo

Comments (5)

rs avatar rs commented on September 16, 2024 2

IDs from the same second have a local monotonic incrementing random inited counter, so they will still sort well when generated on the same machine/process.

from xid.

rs avatar rs commented on September 16, 2024 1

ULID requires locking if you need to use it concurrently.

from xid.

wotzhs avatar wotzhs commented on September 16, 2024 1

many years later, I think another major difference compare to ULID is xid is only up to 1 second precise, meaning sorting is only possible within the same second, whereas ULID is up to millisecond precise.

from xid.

rs avatar rs commented on September 16, 2024 1

For concurrency ULID requires a lock while xid uses an atomic counter as a workaround. Depending on the application, this can be a factor. Conciseness is another.

from xid.

saraf-gaurav avatar saraf-gaurav commented on September 16, 2024

xid seems relatively better if the priority is conciseness, indexing-performance and zero-configurability. But I am not too sure if the locking argument holds true @rs :

ULID requires locking if you need to use it concurrently.

According this comparison of Golang ID packages actually https://github.com/oklog/ulid also achieves fast lock-free concurrent ULID generation

Besides millisecond precision, ULID also enjoys broader support due backward compatibility with UUID columns e.g. Cockroach DB has a builtin function to generate ULIDs for PKs

For a distributed DB like Cockroach DB with xid generated in the application layer over distributed containers / serverless functions sharing a DB cluster, @rs are there any reasons you would still recommend xid over ULID all things considered, especially when there's no guarantee that the xid will be generated on the same machine/process?

from xid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.