Risav Jhunjhunwala
Risav Jhunjhunwala

Reputation: 13

Does redshift redistribute data when I update the value of the dist key in a row?

I have a simple question...

I am inserting rows into redshift with a value x in the dist key column. If later at any stage i update the value of x to y ... 1. Does redshift automatically redistribute the data ? 2. If yes how ? 3. If not how do i redistribute the data, is VACUUM the only solution ?

Upvotes: 1

Views: 346

Answers (1)

Joe Harris
Joe Harris

Reputation: 14035

Yes, UPDATE in Redshift is processed as a DELETE of the current row and INSERT of the changed rows. (NB: This is how we provide transactions that can rollback.)

When the value of the distribution key column is updated the changed rows are sent to the correct node and data slice for the new value.

The deleted rows will temporarily take up storage space in your table until VACUUM DELETE is run. However, this now runs automatically in the background so you should not need to manage it.

Upvotes: 3

Related Questions