cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Krupansky <jack.krupan...@gmail.com>
Subject Re: Modeling contact list, plain table or List<UDT>
Date Fri, 08 Jan 2016 23:50:01 GMT
How big is each contact list expected to be? Dozens? Hundreds? Thousands?
If just dozens, a simple list column would seem sufficient. If thousands,
the row (not partition) would get kind of bloated.

What requirements do you have for updating? If updating contacts and lots
of contacts, I think I'd prefer each contact as a row/clustering key. Nice
to be able to do selective queries to return slices of the clustering key
values, which is not so easy if they are all just a single list column.

-- Jack Krupansky

On Fri, Jan 8, 2016 at 6:31 PM, Isaac P. <ipvp@hotmail.com> wrote:

> 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
>
>

Mime
View raw message