question

sumant7654 avatar image
sumant7654 asked Erick Ramirez edited

What is the fastest way to update all records of a table ?

Hi I have table called customer. This table having 5 Million (5,000,000) or records. I want to update a particular field of all records.
Please suggest me a fastest way to update.

Thanks!

cassandradsbulk
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

If I may suggest, speed shouldn't be your goal -- it should be efficiency. Updating all the records in a table requires a full table scan and you could inadvertently bring your cluster down.

There isn't a ready-made solution for doing this. You could export the data out using the DataStax Bulk Loader (DSBulk) tool. Based on the output, create a new CSV file that contains the partition key(s) and the column you want to update. You can then bulk load it into the cluster using DSBulk.

A more efficient way of doing it is with Spark if you already have a Spark cluster. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.