Question

As we know that time uuid makes a unique id which is related to time but what happens when I want to add same unique id in different tables. Suppose I want to copy the information related to images uploaded to different tables so when the images are uploaded I write a batch statement and in every table I want to give a unique id to the image so I use time uuid... so does all the table get the same id or are they different.

I know that Cassandra is schema-less and I don't require the unique id but I want to use memcached and elasticsearch for faster retrival and searching and what will happen if I want to edit the information of images I will have to search it with the help of userid and other info and then I will be able to change the value. Which as per me is time inefficient.

Is there any other way to do this?

Était-ce utile?

La solution

Each time you generate a time based uuid timeuuid, even if you generate two at the same time it will be unique. This is because inside the timeuuid, it contains both the time and a very big random number.

If you want to use the same timeuuid for a number of tables/records, generate the timeuuid in your code first, and then pass your timeuuid into the cql update statement on both tables using your pre-generated timeuuid.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top