cql

What is the byte size of common Cassandra data types - To be used when calculating partition disk usage?

霸气de小男生 提交于 2019-12-21 09:33:04
问题 I am trying to calculate the the partition size for each row in a table with arbitrary amount of columns and types using a formula from the Datastax Academy Data Modeling Course. In order to do that I need to know the "size in bytes" for some common Cassandra data types. I tried to google this but I get a lot of suggestions so I am puzzled. The data types I would like to know the byte size of are: A single Cassandra TEXT character (I googled answers from 2 - 4 bytes) A Cassandra DECIMAL A

SELECT DISTINCT cql ignores WHERE clause

怎甘沉沦 提交于 2019-12-21 03:32:57
问题 Executing two identical requests but the DISTINCT keyword gives unexpected results. Without the keyword, the result is ok but with DISTINCT, it looks like the where clause is ignored. Why ? Cqlsh version: Connected to Test Cluster at localhost:9160. [cqlsh 4.1.1 | Cassandra 2.0.6 | CQL spec 3.1.1 | Thrift protocol 19.39.0] Table considered: DESCRIBE TABLE events; CREATE TABLE events ( userid uuid, "timestamp" timestamp, event_type text, data text, PRIMARY KEY (userid, "timestamp", event_type)

Cassandra Error - Clustering column cannot be restricted (preceding column is restricted by a non-EQ relation)

心不动则不痛 提交于 2019-12-20 09:56:33
问题 We are using Cassandra as the data historian for our fleet management solution. We have a table in Cassandra , which stores the details of journey made by the vehicle. The table structure is as given below CREATE TABLE journeydetails( bucketid text, vehicleid text, starttime timestamp, stoptime timestamp, travelduration bigint, PRIMARY KEY (bucketid,vehicleid,starttime,travelduration) ); Where: bucketid :- partition key which is a combination of month and year vehicleid : -unique id of the

cassandra:sorting problem,ordering is wrong

牧云@^-^@ 提交于 2019-12-20 04:12:42
问题 I have a question about Cassandra. At present, "entities_by_time" is ok on the 18-bit uuid through column1 sorting, but there is something wrong with uuid ascending to the 19-bit sorting. Please help me. cqlsh:minds> select * from entities_by_time where key='activity:user:990192934408163330' order by column1 desc limit 10; key | column1 | value ----------------------------------+--------------------+-------------------- activity:user:990192934408163330 | 999979571363188746 |

Cassandra: Table design with timestamp and large dataset

巧了我就是萌 提交于 2019-12-20 03:13:52
问题 I am having issues querying large volumes of data by a single day. I am looking for advice on creating an efficient table schema. Table: eventlog Columns: recordid (UUID), insertedtimestamp (timestamp), source (Text), event (Text) If I simply do: CREATE TABLE eventlog ( recordid uuid PRIMARY KEY, insertedtimestamp timestamp, source text, event text ); Then the below query will get overwhelmed by the volume of data, assuming today is 1/25. select * from eventlog where insertedtimestamp > '2017

Cassandra - Overlapping Data Ranges

こ雲淡風輕ζ 提交于 2019-12-19 22:01:45
问题 I have the following 'Tasks' table in Cassandra. Task_ID UUID - Partition Key Starts_On TIMESTAMP - Clustering Column Ends_On TIMESTAMP - Clustering Column I want to run a CQL query to get the overlapping tasks for a given date range. For example, if I pass in two timestamps (T1 and T2) as parameters to the query, I want to get the all tasks that are applicable with in that range (that is, overlapping records). What is the best way to do this in Cassandra? I cannot just use two ranges on

ORDER BY with 2ndary indexes is not supported

送分小仙女□ 提交于 2019-12-19 18:39:13
问题 I am using cassandra 2.1 with latest CQL. Here is my table & indexes: CREATE TABLE mydata.chats_new ( id bigint, adid bigint, fromdemail text, fromemail text, fromjid text, messagebody text, messagedatetime text, messageid text, messagetype text, todemail text, toemail text, tojid text, PRIMARY KEY(messageid,messagedatetime) ); CREATE INDEX user_fromJid ON mydata.chats_new (fromjid); CREATE INDEX user_toJid ON mydata.chats_new (tojid); CREATE INDEX user_adid ON mydata.chats_new (adid); When i

Cassandra: Query with where clause containing greather- or lesser-than (< and >)

流过昼夜 提交于 2019-12-19 06:25:21
问题 I'm using Cassandra 1.1.2 I'm trying to convert a RDBMS application to Cassandra. In my RDBMS application I have following table called table1: | Col1 | Col2 | Col3 | Col4 | Col1: String (primary key) Col2: String (primary key) Col3: Bigint (index) Col4: Bigint This table counts over 200 million records. Mostly used query is something like: Select * from table where col3 < 100 and col3 > 50; In Cassandra I used following statement to create the table: create table table1 (primary_key varchar,

Creating column family or table in Cassandra while working Datastax API(which uses new Binary protocol)

孤街醉人 提交于 2019-12-19 03:38:11
问题 I have started working with Cassandra database. I am planning to use Datastax API to upsert/read into/from cassandra database. I am totally new to this Datastax API (which uses new Binary protocol) and I am not able to find lot of documentations as well which have some proper examples. When I was working with Cassandra CLI using the Netflix client(Astyanax client), then I created the column family like this- create column family profile with key_validation_class = 'UTF8Type' and comparator =

Cassandra selective copy

我们两清 提交于 2019-12-18 19:39:37
问题 I want to copy selected rows from a columnfamily to a .csv file. The copy command is available just to dump a column or entire table to a file without where clause. Is there a way to use where clause in copy command? Another way I thought of was, Do "Insert into table2 () values ( select * from table1 where <where_clause> );" and then dump the table2 to .csv , which is also not possible. Any help would be much appreciated. 回答1: There are no way to make a where clause in copy, but you can use