I need to execute a one-time task to update all rows in a large database. I want to do this as quickly as possible. Each row needs to be read, have a value in a column modified by an algorithm, and then updated with the transformed value. I have written a single partitioned stored procedure to do this.
I am aware of the examples on this page: https://docs.voltdb.com/UsingVoltDB/sysprocgetpartitionkeys.php
I would rather not have to write a java client to execute this procedure in each partition, and would ideally like to call @GetPartitionKeys, then execute the stored procedure on each value, in sqlcmd.
I found a way to do it using pipelines in bash:
echo "exec @GetPartitionKeys INTEGER;" | sqlcmd --output-skip-metadata | awk '{print $2}' | xargs -n 1 sh -c 'echo "exec YourPartitionedProcedure $0;" | sqlcmd'
This will take the partition key column and then execute YourPartitionedProcedure once for each partition key returned. You can add additional parameters as needed after the $0. You can switch INTEGER to STRING as needed as well.