1

uuid or Universally unique identifier and timeuuid are long 128-bit value.

In Cassandra database and because of its concepts I used uuid and timeuuid for our entities identifier and now I want to compress uuid and timeuuid or reduce its size when client (user) can see the id in the URL bar.

For example Twitter also used Cassandra but when you open a Tweet, the Tweet's id is like 10153967535312713 but a simple uuid is like 10646334-2c02-11e6-bb4a-7720eb141b83 that is more characters and not user friendly (of course both IDs are not user friendly :D)

In different programming languages there are some compression functions, such as gzcompress in PHP and GZIPOutputStream in Java but these functions (classes) will compress data and return in GZIP format which is not allowed to use in URL!

Now just by the way is there any way or function/algorithm to get smaller or compressed version of a uuid or timeuuid?

Community
  • 1
  • 1
Mohammad Kermani
  • 5,188
  • 7
  • 37
  • 61
  • 2
    UUIDs are extremely unlikely to be compressible -- you can't compress random data, and UUIDs are usually randomized. (And any shorter random data would have a correspondingly higher likelihood of being not actually unique.) – Louis Wasserman Jun 06 '16 at 22:14

1 Answers1

5

Twitter originally developed Snowflake a long time ago and I believe that it is this id that Twitter is still using. There are now many flake id implementations available that can generate a UUID like number instead of a true UUID. I have used Flake Java in a project of mine.

stdunbar
  • 16,263
  • 11
  • 31
  • 53