Create Keyspace & Table
Column : Is a name/value Pair #61Row : Is referenced using Primary Key #61
Table : Similar to Table in RDBMS
Keyspace : Similar to Database in RDBMS
// Create Keyspace
cqlsh> create keyspace firstkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
// Create table
create table firstkeyspace. firsttable(
subject text,
mark text,
primary key(subject));
Describe Keyspace & Table
cqlsh:firstkeyspace> describe keyspace firstkeyspace;
CREATE KEYSPACE firstkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
CREATE TABLE firstkeyspace.firsttable (
subject text PRIMARY KEY,
mark text
) WITH 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';
cqlsh:firstkeyspace>
cqlsh:firstkeyspace> // Describe table
cqlsh:firstkeyspace> describe table firstkeyspace. firsttable;
CREATE TABLE firstkeyspace.firsttable (
subject text PRIMARY KEY,
mark text
) WITH 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';
A Column which has the same value for all the rows in a Table can be made as Static Column #60
No comments:
Post a Comment