2014-01-13 26 views

答えて

15

SELECT column_name, index_name, index_options, index_type, component_index 
FROM system.schema_columns 
WHERE keyspace_name='samplekp'AND columnfamily_name='sampletable'; 

服用を、例えば、以下の表の宣言:

CREATE TABLE sampletable (
key text, 
date timestamp, 
value1 text, 
value2 text, 
PRIMARY KEY(key, date)); 

CREATE INDEX ix_sample_value2 ON sampletable (value2); 

上記のクエリは何か、この結果になるだろう:

column_name | index_name  | index_options | index_type | component_index 
-------------+------------------+---------------+------------+----------------- 
     date |    null |   null |  null |    0 
     key |    null |   null |  null |   null 
     value1 |    null |   null |  null |    1 
     value2 | ix_sample_value2 |   {} | COMPOSITES |    1 
8

最も簡単な方法はDESC cオマンド

DESC TABLE "Table_Name"はあなたが望むものを取得します

2
cqlsh:system> show version 
[cqlsh 5.0.1 | Cassandra 2.1.2-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3] 


cqlsh:system> desc table "IndexInfo" 

CREATE TABLE system."IndexInfo" (
table_name text, 
index_name text, 
"" blob, 
PRIMARY KEY (table_name, index_name) 
) WITH COMPACT STORAGE 
AND CLUSTERING ORDER BY (index_name ASC) 
AND bloom_filter_fp_chance = 0.01 
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}' 
AND comment = 'indexes that have been completed' 
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.0 
AND default_time_to_live = 0 
AND gc_grace_seconds = 0 
AND max_index_interval = 2048 
AND memtable_flush_period_in_ms = 3600000 
AND min_index_interval = 128 
AND read_repair_chance = 0.0 
AND speculative_retry = '99.0PERCENTILE'; 

cqlsh:system> select * from "IndexInfo"; 

table_name | index_name 
------------+--------------------------------- 
    musicdb | performer.performer_country_key 
    musicdb | performer.performer_style_key 
    musicdb |  user.user_preferences_key 

(3 rows) 
関連する問題