October 2018
Beginner to intermediate
348 pages
10h
English
Static columns are data that is more dependent on the partition keys than on the clustering keys. Specifying a column as STATIC ensures that its values are only stored once (with its partition keys) and not needlessly repeated in storage with the row data.
A new table can be created with a STATIC column like this:
CREATE TABLE packt_ch3.fighter_jets ( type TEXT PRIMARY KEY, nickname TEXT STATIC, serial_number BIGINT);
Likewise, an existing table can be altered to contain a STATIC column:
ALTER TABLE packt_ch3.users_by_dept ADD department_head TEXT STATIC;
Now, we can update data in that column:
INSERT INTO packt_ch3.users_by_dept (department,department_head) VALUES('Engineering','Richard');INSERT INTO packt_ch3.users_by_dept (department,department_head) ...