cassandra - How to denormalize deep hierarchies? -
i’ve read quite lot cassandra , art of denormalization , materialization while writing data. think understand concept, , seems make sense. however, having trouble implementing in scenarios there deep hierarchical data structure.
consider contrived domain
owner 1:* company
company 1:* teams
team 1:* players
players 1:* equipment
we have tables each of these entities, query equipment attributes owner seems thing create table (ownerequipment) has owner id , equipment id primary key owner id partition key. makes sense, if ux scenarios add , edit equipment not include owner’s id part of working set?
most of denormalization examples i’ve encountered in research single level parent-child or master-detail type use case. seems pretty reasonable updating client have enough information immediate parent when updating child write denormalized reverse index, if data denormalize several “joins” away?
this problem compounded further in our example when consider company sold different owner. assume desired behavior ownerequipment reflect change. how should code writes updated company database handle ownerequipment table updates? should it, knowing id of old owner, try update ownerequipment records owner? seems un-cassandra-y thing , fraught concurrency issues. problem gets worse move down chain (team new company, player new team). in these cases “old owner” not in working set , need read in order updated.
are there better ways think problem?
this makes sense, if ux scenarios add , edit equipment not include owner’s id part of working set?
easy, pass owner id along equipment id ux. owner id can hidden value not shown on interface
but if data denormalize several “joins” away?
create many tables different query use-cases
for multiple updates , denormalizations, can @ new materialized views feature. read blog: www.doanduyhai.com/blog/?p=1930
Comments
Post a Comment