57
loading...
This website collects cookies to deliver better user experience
DESCRIBE car
CREATE TABLE automobilies.car (
id uuid PRIMARY KEY,
brand text,
color text,
model text
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
AND comment = ''
AND compaction = {'class': 'SizeTieredCompactionStrategy'}
AND compression = {'sstable_compression': '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 = '99.0PERCENTILE';
cqlsh:automobilies> select * from car;
id | brand | color | model
--------------------------------------+-------+-------+-------
f714e8e5-b160-4341-807d-f4cd92b973a4 | VW | Red | Golf
cqlsh:automobilies> insert into car (id, brand, color, model) values (e0625c94-e9c2-11eb-9a03-0242ac130003, 'Ford', 'Red', 'Focus');
cqlsh:automobilies> insert into car (id, brand, color, model) values (fbd04f2c-511a-43c5-b588-9e29ebcb5d7a, 'VW', 'Nardo Grey', 'Passat');
id | brand | color | model
--------------------------------------+-------+------------+--------
fbd04f2c-511a-43c5-b588-9e29ebcb5d7a | VW | Nardo Grey | Passat
e0625c94-e9c2-11eb-9a03-0242ac130003 | Ford | Red | Focus
f714e8e5-b160-4341-807d-f4cd92b973a4 | VW | Red | Golf
cqlsh:automobilies> select * from car where id = f714e8e5-b160-4341-807d-f4cd92b973a4;
id | brand | color | model
-------------------------------------------+-------+-------+-------
f714e8e5-b160-4341-807d-f4cd92b973a4 | VW | Red | Golf
(1 rows)
cqlsh:automobilies> select * from car where id = f714e8e5-b160-4341-807d-f4cd92b973a4 and color = 'Red';
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING"
cqlsh:automobilies> select * from car where id = f714e8e5-b160-4341-807d-f4cd92b973a4 and color = 'Red' ALLOW FILTERING;
id | brand | color | model
-------------------------------------------+-------+-------+-------
f714e8e5-b160-4341-807d-f4cd92b973a4 | VW | Red | Golf
(1 rows)
cqlsh:automobilies> select * from car where id = f714e8e5-b160-4341-807d-f4cd92b973a4 and color = 'Green' ALLOW FILTERING;
--------MORE---
(0 rows)
cqlsh:automobilies> CREATE TABLE car (id uuid, brand text, color text, model text, PRIMARY KEY (id, color));
cqlsh:automobilies> DESCRIBE car;
CREATE TABLE automobilies.car (
id uuid,
color text,
brand text,
model text,
PRIMARY KEY (id, color)
) WITH CLUSTERING ORDER BY (color ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
AND comment = ''
AND compaction = {'class': 'SizeTieredCompactionStrategy'}
AND compression = {'sstable_compression': '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 = '99.0PERCENTILE';
cqlsh:automobilies> insert into car (id, brand, color, model) values (f714e8e5-b160-4341-807d-f4cd92b973a4, 'VW', 'Red', 'Golf');
cqlsh:automobilies> insert into car (id, brand, color, model) values (e0625c94-e9c2-11eb-9a03-0242ac130003, 'Ford', 'Red', 'Focus');
cqlsh:automobilies> insert into car (id, brand, color, model) values (fbd04f2c-511a-43c5-b588-9e29ebcb5d7a, 'VW', 'Red', 'Passat');
cqlsh:automobilies> insert into car (id, brand, color, model) values (fbd04f2c-511a-43c5-b588-9e29ebcb5d7a, 'VW', 'Green', 'Passat');
cqlsh:automobilies> insert into car (id, brand, color, model) values (f714e8e5-b160-4341-807d-f4cd92b973a4, 'VW', 'Green', 'Golf');
cqlsh:automobilies> select * from car;
id | color | brand | model
-------------------------------------------+-------+-------+--------
fbd04f2c-511a-43c5-b588-9e29ebcb5d7a | Green | VW | Passat
fbd04f2c-511a-43c5-b588-9e29ebcb5d7a | Red | VW | Passat
e0625c94-e9c2-11eb-9a03-0242ac130003 | Red | Ford | Focus
f714e8e5-b160-4341-807d-f4cd92b973a4 | Green | VW | Golf
f714e8e5-b160-4341-807d-f4cd92b973a4 | Red | VW | Golf
cqlsh:automobilies> select * from car where id = fbd04f2c-511a-43c5-b588-9e29ebcb5d7a and color = 'Red';
id | color | brand | model
-------------------------------------------+-------+-------+--------
fbd04f2c-511a-43c5-b588-9e29ebcb5d7a | Red | VW | Passat
(1 rows)