database - Data Modeling and uuid on Cassandra -
I am trying to create a movie database for academic purposes that use the concept in backend. Inquiries on the database will be mainly done by the Movie Title . That's why I currently have data that fits in the following models.
movie title | IMDb Rating | Year of Release | Artists
Reading the CQ Documentation I found the music playlist example where the following structure was used
create table playlist (id uuid, song_number, song_id uidid, title text, album Text, artist text, primary key (id, song_order);
Why do I have to use Query Separate ID column? Title column can not be used as a primary key? What are the advantages and disadvantages of not using a different UIID field?
The commands I am preparing for my model
create table movies (title text, IMDb_Rating double, end of year, actor text, primary key (title, IMDb_Rating ));
I believe here my model title is primary key
and partition key
and imdb_rating CLUSTERING KEY
(To arrange production in ascending order) Is there anything wrong with my model and how it affects the distribution of data and why should not I use the UUD? I am planning to keep replica_actor of 2 because I am using only 3 nodes.
Also, according to the document
Do not use an index in these situations:
On frequently updated or deleted columns
The most updated column in my database is IMDb_riting, so I am not making any secondary index on it.
Can the title column be used as a primary key?
If the title of the movie is unique (which is not necessary) then you can use the title as the primary key.
The advantages and disadvantages of not using the separate UIUID field?
UUID is good if you need unique ID which is unique worldwide and you do not have to check for its specificity if you can get a set of columns which can be given to them If the combination is exclusive, you do not need to use UUID (assuming you do not need an ID to reference it). But it all depends on your query pattern. If you are going to watch a movie with your movie (perhaps coming from another table) then use the UUID as the primary key. If you want to find movies with a specific title, use the title as the primary key.
is not unique since the title, use the combination key combination of title and UUID, given that you will search by title.
I believe that my model title is the primary key and luck key and imdb_rating is the clustering key (for the production system in ascending order). Is there something wrong with my model and how will it affect the distribution of data and why should not I use the UUD?
In this situation you have to use the rating and the UUID is the primary key, but when you ask if you have permission for filtering.
Comments
Post a Comment