Cassandra - quickly delete all rows stored in primary key value?

I am creating a table that will contain a lot (we say a million if not a billion) of data stored in a primary key, which will be the year stored as an int. We do this because we want to do a simple cleanup.

Table

as follows:

TABLE data (
 year int,
 fulldate date,
 ref1 text,
 ref2 text,
 data blob,
 PRIMARY KEY ((year), fulldate, ref1, ref2)
);

      

In the future, we plan to delete all data for a year and will not add more data for that particular year.

Is it possible to effectively delete all data stored in the primary key? How do you do something like a drop?

I haven't seen anything like this in the dock, but I'm new to Cassandra, so maybe there is an internal optimization or something?

Thanks for the help.

+3


source to share


1 answer


Yes, you can delete all partition key data with just one request.

Just include the year of the partition key when deleting.



DELETE from data WHERE year = 2017;

      

And it is effective because it only creates one headstone for that section meaning.

+2


source







All Articles