sikandar
sikandar

Reputation: 21

Altering a Cassandra UDT column

I have a Cassandra UDT column that has about 10 attributes and now we are planning to add 3 more attributes to it. I am wondering if it would behave well if I alter the UDT type in the higher environments which has very large volume of data.

Upvotes: 1

Views: 1507

Answers (3)

Simply Maria
Simply Maria

Reputation: 1

Additional pointers when you alter your table with UDT collections data type:

  • Never insert more than 2 billion items in a collection, as only that number can be queried.
  • The maximum number of keys for a map collection is 65,535.
  • The maximum size of an item in a list or a map collection is 2GB.
  • The maximum size of an item in a set collection is 65,535 bytes.
  • Keep collections small to prevent delays during querying.
  • Collections cannot be "sliced"; Cassandra reads a collection in its entirety, impacting performance.

Click here for more information.

[Alex Ott] MAP & LIST limits are version dependent. 65,535 bytes are supported by v3.0+ while lower versions are limited to 64,000 bytes. Fix version ticket.

Upvotes: 0

karikevinod
karikevinod

Reputation: 691

Altering UDT is same as altering table, except that you cannot remove an existing UDT unless you drop all the depended tables. Also you can't alter type of a column. Below is the query how you could add new udt columnd.

alter TYPE commentmetadata ADD columnname <type>;

Upvotes: 1

Laxmikant
Laxmikant

Reputation: 1611

It should be safe. Just few precautions:

  1. Don't run in mixed version Cassandra cluster.
  2. Don't try to do same schema change concurrently from multiple client ( driver)

Upvotes: 0

Related Questions