1つのポイントの近くの緯度と経度のポイントを取得するために、ダブルレンジクエリを実行したいと思います。
Cassandraでは今は可能だと思われます
create column family users
with comparator=UTF8Type
AND key_validation_class=UTF8Type
and column_metadata=[{column_name: full_name, validation_class: UTF8Type},
{column_name: type, validation_class: UTF8Type, index_type: KEYS},
{column_name: lat, validation_class: LongType, index_type: KEYS},
{column_name: lon, validation_class: LongType, index_type: KEYS}];
SET users['a']['type']='test';
SET users['b']['type']='test';
SET users['c']['type']='test';
SET users['a']['lat']='12';
SET users['b']['lat']='9';
SET users['c']['lat']='12';
SET users['b']['lon']='1';
SET users['a']['lon']='4';
SET users['c']['lon']='2';
get users where type = 'test' and lon < '6' and lon > '3' and lat > '10' and lat < '13';
RowKey:a =>(column = lat、value = 12、timestamp = 1336339056413000)=>(column = lon、value = 4、timestamp = 1336339088170000)=>(column = type、value = test、timestamp = 1336339033765000)
1行が返されました。
しかし、これらの3つの列にインデックスが付けられている場合、数千のポイントを追加するときのパフォーマンスが非常に心配です。
1)インデックス付きの「type」列を使用する必要がありました。これがないと、クエリが失敗するためです。
No indexed columns present in index clause with operator EQ
それを回避することは可能ですか?
2)すべてのデータをlatまたはlonで自然に並べ替えてから、もう一方のデータをクエリするのは興味深いかもしれません。
したがって、xとyの間の緯度に対してSliceQueryを実行し、その後にクエリを実行するだけです。
get users where type = 'test' and lon < '6' and lon > '3';
行名ではなく別のフィールド(例:文字列lat + lonおよびUTF8コンパレータ)でCFを並べ替えるには、どうすればよいですか?
ありがとう