の過剰な量を取り、クエリがカサンドラクエリは、私は、エンティティ(約10億記録)の非常に大きな鍵空間を照会するカサンドラを使用していた時間
鍵空間がどのように見える多くの時間がかかるようだ:
次のクエリを実行しているCREATE KEYSPACE IF NOT EXISTS DB WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':1};
CREATE TABLE IF NOT EXISTS DB.table (time timeuuid, channelId int, datetime Timestamp, description text,
att1 boolean,
att2 boolean,
att3 boolean,
att4 boolean,
image blob,
PRIMARY KEY(channelId, time));
ALTER TABLE DB.table WITH compaction = {'class': 'DateTieredCompactionStrategy', 'base_time_seconds':'3600', 'max_sstable_age_days':'365'}
ALTER TABLE DB.table WITH GC_GRACE_SECONDS = 3600;
CREATE CUSTOM INDEX att1index ON SUSEDB.suspectentity (att1) USING 'org.apache.cassandra.index.sasi.SASIIndex';
CREATE CUSTOM INDEX att2index ON SUSEDB.suspectentity (att2) USING 'org.apache.cassandra.index.sasi.SASIIndex';
select channelid from suspectentity where channelid = 100 and time >= mintimeuuid('2016-06-29 23:00') and time <= mintimeuuid('2016-06-29 23:50') and att1= true;
クエリは約4.5秒間に実行
、なぜtaのそれを何「マージされたmemtablesからのデータと23 sstables」中に何が起こっているとあまりにも長い?
>Preparing statement - 396
>
>Index mean cardinalities are attributesfacehat:-9223372036854775808. Scanning >with att1index. - 1545
>
>Computing ranges to query - 1583
>
>Submitting range requests on 1 ranges with a concurrency of 1 (-3.24259165E16 >rows per range expected) - 1638
>
>Submitted 1 concurrent range requests - 1688
>
>Executing read on susedb.suspectentity using index attributesfacehat - 5453
>
>Executing single-partition query on suspectentity - 6450
>
>Acquiring sstable references - 6487
>
>cache hit for sstable 5520 - 6669
>
>cache hit for sstable 5487 - 6967
>cache hit for sstable 5569 - 36011
>
>cache hit for sstable 5309 - 36324
>
>cache hit for sstable 5085 - 36564
>
>Skipped 21/26 non-slice-intersecting sstables, included 18 due to tombstones - 230753
>
>cache hit for sstable 5968 - 230920
>
>cache hit for sstable 5939 - 231177
>
>cache hit for sstable 5933 - 231363
>
>cache hit for sstable 5922 - 231533
>
>cache hit for sstable 5901 - 231717
>
>cache hit for sstable 5896 - 231892
>
>cache hit for sstable 5886 - 232056
>
>cache hit for sstable 5879 - 232265
>
>cache hit for sstable 5943 - 232418
>
>cache hit for sstable 5751 - 232615
>
>cache hit for sstable 5777 - 232769
>
>cache hit for sstable 5969 - 232949
>
>cache hit for sstable 5627 - 233133
>
>cache hit for sstable 5680 - 233321
>
>cache hit for sstable 5489 - 262047
>
>cache hit for sstable 5326 - 283459
>
>cache hit for sstable 5581 - 283539
>
>cache hit for sstable 5348 - 283620
>
>Merged data from memtables and 23 sstables - 4321883
>Read 500 live and 0 tombstone cells - 4324074
それぞれの 'channelId'には何時間エントリがありますか?パーティションキーで制限しているので、これは高速なクエリでなければなりません。しかし、パーティションが非常に大きい場合は、パーティションサイズを小さくするためにパーティションを再分割するか、「バケツ」する必要があります。 – Aaron
@Aaron - 答えは 'IN'クエリを使うことです。 – tymeJV
各チャンネルIDの下に約2000万のエントリがあります –