DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


jtdelato avatar image
jtdelato asked Erick Ramirez commented

How do I find the UUID used as the partition key?

This may be a very stupid question, but I can't seem to find an answer in the forums or other sites:

If I use a uuid as the partition key, how would I find the value of the uuid to perform a query if the uuid was generated on INSERT using the uuid() function?

In the academy exercises, the uuid is usually found by performing a SELECT * query with no WHERE clause and then finding a row's uuid from a visual scan. Obviously, this would only work for very small data sets.

How is this accomplished in real-world scenarios?

Would I create another table with a natural key for the partition key (such as a person's name or email) and then use the result of that query to find the uuid for my original query?

Thank you for helping me understand what I'm sure is a very simple answer.

data modeling
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

You won't be able to find the UUID if it is the partition key. As you know, each partition is identifiable only by the partition key so you need to know it in order to query the table.

The Academy exercises was only using UUIDs as an example. For this reason, you need to use natural keys such as email addresses or user IDs as partition keys so you can query the table with known information.

Specifically on creating another table as a "lookup", this is unnecessary since it means you have to do an extra lookup when you can simply use natural keys. Cheers!

4 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thank you Erick!

That clears it up!

So, just a quick follow-up, natural keys would be preferred as a partition key and then a surrogate key added simply for uniqueness should be a clustering key?

0 Likes 0 ·

Yes, but only where absolutely necessary like in the case of movie titles which aren't unique so we add the release year as I discussed in this post. Cheers!

0 Likes 0 ·
jtdelato avatar image jtdelato Erick Ramirez ♦♦ ·

Thank you Erick! I really appreciate all your help! That link was very helpful.

0 Likes 0 ·
Show more comments