Cassandra 查询密钥的一部分 [英] Cassandra querying on a part of a key

查看:30
本文介绍了Cassandra 查询密钥的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 cassandra 列族,它有一个像2012-09-30-05-42-00:30:5856869

I have a cassandra column family which has a row key like 2012-09-30-05-42-00:30:5856869

我需要查询诸如

select * from cf where key like %5856869%

目前我正在使用 Astyanax ,在 astyanax 中也是可能的.如果不是,哪个实现会支持它.

Currently I am using Astyanax , is same possible in astyanax. If not, which implementation would support it.

推荐答案

Cassandra 不支持 LIKE 查询.如果要基于键的一部分进行查询,则需要使用复合键.但在这种特定情况下,密钥的 5856869 部分必须是您执行所需操作的第一部分.请记住,使用 Cassandra,您必须按照预期读取数据的方式编写数据.

LIKE queries are not supported in Cassandra. If you want to query based on part of a key, you'll want to use composite keys. But in this specific case, the 5856869 portion of the key would have to be the first part for you to do what you want. Remember that with Cassandra, you must write your data the way you expect to read it.

这篇关于Cassandra 查询密钥的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆