cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DOAN DuyHai (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CASSANDRA-10533) Allowing to have static columns attached to clustering columns
Date Thu, 15 Oct 2015 12:21:05 GMT
DOAN DuyHai created CASSANDRA-10533:
---------------------------------------

             Summary: Allowing to have static columns attached to clustering columns
                 Key: CASSANDRA-10533
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10533
             Project: Cassandra
          Issue Type: Improvement
          Components: Core
            Reporter: DOAN DuyHai


Now that [CASSANDRA-8099] is done, can we look again into the idea of having *static columns*
respective to clustering column ?

I have a very relevant use-case for a customer. They want to store store an hierarchy of data
for user expenses:

{code:sql}
CREATE TABLE user_expenses(
 user_id bigint,
 firstname text static,
 lastname text static,
 report_id uuid,
 report_title text,
 report_amount double,
 report_xxx ....
 ...,
 line_id uuid,
 line_item text,
 line-amount double,
 ...
 PRIMARY KEY((user_id), report_id, line_id)
)
{code}

So basically we have 2 levels of nesting:
 1 user - N reports
 1 report - N lines

 With the above data model,  all report data are *duplicated* for each line so that any update
on report_title or other report property will require the *anti-pattern read-before-write*:

 1. Select all line_id for this report_id
 2. For each line_id, perform the update

One possible trick is to use a static map<report_id, report_property> but it's far from
being elegant, not to say dirty.

So I believe that there is definitely a need for static columns that are *relative* to a clustering
column. 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message