评论 Cassandra 的键空间,table,专栏

Commenting Cassandra's keyspace, table, column

在 Oracle 中,有可能 add a comment 关于 table、视图、物化视图或列到数据字典中,例如

COMMENT ON COLUMN employees.job_id 
   IS 'abbreviated job title';

作为一名测试人员,我发现这在尝试理解大型数据库(超过 200 tables)中不一定能自我解释的名称背后的想法时特别有用。

Cassandra有这样的功能吗?

您可以使用 'with comment' 选项

cqlsh:d2> 
cqlsh:d2> create table employee (id int primary key, name text) with comment = 'Employee id and name';
cqlsh:d2> desc table employee;

CREATE TABLE d2.employee (
    id int PRIMARY KEY,
    name text
) WITH bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = 'Employee id and name'
    AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

Cassandra documentation