Cassandra 2 - list existing indexes with CQL 3

后端 未结 4 1724
北恋
北恋 2020-12-30 08:10

Is there a CQL query to list all existing indexes for particular key space, or column family?

4条回答
  •  太阳男子
    2020-12-30 08:50

    Assuming you have a table named moviesongs, firing a statement as DESCRIBE moviesongs; you will get the following output:

    cqlsh:practice> describe moviesongs ;
    
    CREATE TABLE practice.moviesongs (
        moviename text,
        year int,
        songname text,
        songnum int,
        PRIMARY KEY (moviename, year)
    ) WITH CLUSTERING ORDER BY (year DESC)
        AND bloom_filter_fp_chance = 0.01
        AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
        AND comment = ''
        AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
        AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
        AND crc_check_chance = 1.0
        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 = '99PERCENTILE';
    CREATE INDEX index1 ON practice.moviesongs (year);
    

    Look at the last line, it describes the index on the moviesongs table.

提交回复
热议问题