Re: Mutable primary key in a table

2015-02-08 Thread Colin
Another way to do this is to use a time based uuid for the primary key (partition key) and to store the user name with that uuid. In addition, you'll need 2 additonal tables, one that is used to get the uuid by user name and another to track user name changes over time which would be organized

Re: Mutable primary key in a table

2015-02-08 Thread Eric Stevens
It sounds like changing user names is the kind of thing which doesn't happen often, in which case you probably don't have to worry too much about the additional overhead of using logged batches (not like you're going to be doing hundreds to thousands of these per second). You probably also want

Re: Mutable primary key in a table

2015-02-08 Thread Jack Krupansky
What is your full primary key? Specifically, what is the partition key, as opposed to clustering columns? The point is that the partition key for a row is hashed to determine the token for the partition, which in turn determines which node of the cluster owns that partition. Changing the

Re: Mutable primary key in a table

2015-02-08 Thread Colin Clark
No need for CAS in my suggestion - I would try to avoid the use of CAS if at all possible. It’s better in a distributed environment to reduce dimensionality and isolate write/read paths (event sourcing and CQRS patterns). Also, just in general, changing the primary key on an update is

Re: Mutable primary key in a table

2015-02-07 Thread Eric Stevens
I'm struggling to think of a model where it makes sense to update a primary key as a typical operation. It suggests, as Adil said, that you may be reasoning wrong about your data model. Maybe you can explain your problem in more detail - what kind of thing has you updating your PK on a regular

Re: Mutable primary key in a table

2015-02-07 Thread Ajaya Agrawal
On Sun, Feb 8, 2015 at 5:03 AM, Eric Stevens migh...@gmail.com wrote: I'm struggling to think of a model where it makes sense to update a primary key as a typical operation. It suggests, as Adil said, that you may be reasoning wrong about your data model. Maybe you can explain your problem

Re: Mutable primary key in a table

2015-02-06 Thread Ajaya Agrawal
On Fri, Feb 6, 2015 at 7:43 PM, Adil adil.cha...@gmail.com wrote: Hi, it seems you are doing some thing wrong in your model, why can you go with updating columns of key1 instead of deleting/inserting row key? You can't update a primary key column with update statements.

Mutable primary key in a table

2015-02-06 Thread Ajaya Agrawal
Hi guys, I want to take a row with primary key K1, rewrite it with primary key K2, and delete the original data with key K1, atomically. It seems like the only solution which won't have race conditions is to use batch statement to delete the old row and insert the new one. But the documentation

Re: Mutable primary key in a table

2015-02-06 Thread Adil
Hi, it seems you are doing some thing wrong in your model, why can you go with updating columns of key1 instead of deleting/inserting row key? 2015-02-06 15:02 GMT+01:00 Ajaya Agrawal ajku@gmail.com: Hi guys, I want to take a row with primary key K1, rewrite it with primary key K2, and