0

I'm a newbie to cassandra. I have a confusion with archival of data. Following is the approach I am trying to implement.

  • Filter the records to be archived.
  • Create a new column family
  • Move the filtered records to the new column family
  • Delete the filtered records from existing column family

Filter the records to be archived. - Achieved with the use of secondary indexes
Create a new column family Create Query
Move the filtered records to the new column family I thought of implementing this by the approach mentioned in cassandra copy data from one columnfamily to another columnfamily
But this copies all the data from column family 1 to 2. Is it possible to move only the filtered rows to new column family?
Delete the filtered records from existing column family I am not sure of how to achieve this in CQL. Please help me.

Additionally, Let me know if there is any better approach.

Community
  • 1
  • 1
Poppy
  • 2,902
  • 14
  • 51
  • 75

1 Answers1

0

COPY then DELETE sounds like a valid strategy here.

For deleting rows, take a look at the DELETE command, it takes the same WHERE condition as a SELECT does.

Unfortunately this won't work for a query that requires "ALLOW FILTERING", although there is an enhancement request to add this.

Community
  • 1
  • 1
centic
  • 15,565
  • 9
  • 68
  • 125
  • I am not sure of deleting only the filtered rows from existing Column family. My select query is something like select * from sample where name='abc' and score>=50 and score<=100 limit 1000 allow filtering; I am not sure of applying this in delete. – Poppy Aug 04 '14 at 12:21
  • Unfortunately this won't work for a query that requires "ALLOW FILTERING" according to http://stackoverflow.com/questions/18515874/cassandra-delete-by-secondary-index-or-by-allowing-filtering, although there is an enhancement request to add this at https://issues.apache.org/jira/browse/CASSANDRA-5527 – centic Aug 04 '14 at 12:48