【发布时间】:2014-09-13 16:30:12
【问题描述】:
从下面的表格架构中,我尝试选择所有低于 5 的 pH 读数。
我听从了这三条建议:
- 使用允许过滤
- 包括相等比较
- 在 reading_value 列上创建二级索引。
这是我的查询:
select * from todmorden_numeric where sensor_name = 'pHradio' and reading_value < 5 allow filtering;
此消息被拒绝:
Bad Request: No indexed columns present in by-columns clause with Equal operator
我尝试向 sensor_name 列添加二级索引,但被告知它已经是键的一部分,因此已经被索引。
我在表使用了一段时间后创建了索引 - 这可能是问题吗?我运行“nodetool refresh”,希望它能使索引可用,但这不起作用。这是describe table todmorden_numeric 的输出:
CREATE TABLE todmorden_numeric (
sensor_name text,
reading_time timestamp,
reading_value float,
PRIMARY KEY ((sensor_name), reading_time)
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='Data that suits being stored as floats' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
index_interval=128 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
default_time_to_live=0 AND
speculative_retry='99.0PERCENTILE' AND
memtable_flush_period_in_ms=0 AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'LZ4Compressor'};
CREATE INDEX todmorden_numeric_reading_value_idx ON todmorden_numeric (reading_value);
【问题讨论】:
标签: cassandra cql secondary-indexes range-query