Cassandra 1.1 составные ключи, столбцы и фильтрация в CQL 3
Я хотел бы иметь таблицу что-то следующее:
CREATE TABLE ProductFamilies (
ID varchar,
PriceLow int,
PriceHigh int,
MassLow int,
MassHigh int,
MnfGeo int,
MnfID bigint,
Data varchar,
PRIMARY KEY (ID)
);
Всего 13 полей. Большинство из них представляют собой ведра. Данные - это JSON идентификаторов семейства продуктов, которые затем используются в следующем запросе.Given how Cassandra works, the column names under the hood will be the values. I wish to filter these.
Я хочу выполнить запросы следующим образом:
SELECT Data FROM MyApp.ProductFamilies WHERE ID IN (?, ?, ?) AND PriceLow >= ?
AND PriceHigh <= ? AND MassLow >= ? AND MassHigh <= ? and MnfGeo >= ? AND
MnfGeo <= ?
I read that Cassandra can only execute WHERE predicates against composite row keys or indexed columns. Is this still true? If so, I would have to make the columns < Data part of the PK.
Is it still the case that one has to include all columns from left to right and cannot skip any?
Are there any non-optimum points in my design?
I would like to add a column "Materials", which is an array of possible materials in a product family. Think pizza toppings, and querying "WHERE Materials IN ('Pineapple')". Without creating a separate inverted index of materials and then performing a manual intersection against the above query, is there any other [more elegant] way of handling this in Cassandra?