Hi everyone

What would perform better while modeling a simple user contact list  that will 
be used mainly to select the recipients for/from/to messages ?

a) Individual rows to each (user, contact) pair so a select would fetch all the 
rows  to retrieve all the contacts from a given user.

or

b) A single row for each user containing the List<Contact>  UDT.

Aside of the basic CRUD, the queries will be the following ones:

Select * from user_contact_list where user_id = :userid order by contact_name 
asc

Select * from user_contact_list where user_id = :userid and is_favorite = true 
order by contact_name asc

After reading this 
https://docs.datastax.com/en/cql/3.0/cql/ddl/ddl_compound_keys_c.html  the 
table is looking like this:

CREATE TABLE communication.user_contact_list (
user_id uuid,
contact_id uuid,
contact_name text,
created_at timeuuid,
is_favorite boolean,
favorite_at timestamp,
PRIMARY KEY (user_id, contact_name, is_favorite)
);

Any guidance will be appreciated.

Thanks

--
IPVP

Reply via email to