以下の技術に関する知識が不足しているので、私にご負担ください。Hbaseでは、MySQLにEXPLAINのような関数がありますか?
私たちは完了までに45分かかっていたクエリ(60kクエリ)をたくさん作っていました。今、それはほぼ同じ量のために3時間20分かかります。それをコード化した人はここにはもういないので、何が起きているのか完全にはわからない。
私のチームのリードは、SQLにEXPLAINのようなコマンドがあり、行のキーを検索するときにhbaseがどのように領域を通過しているかを確認するように頼んだ。私はそれをGoogleにしようとしましたが、それはそこにあるように見えません。 HbaseにSQLのEXPLAINに似たコマンドがいくつかありますか?
質問に役立つ場合は、時系列データを保存しています。 rowKeyの形式は次のとおりです。
hashOfName_elementName_epochtime
私たちは、HBaseのは時間から避けるために、どの地域を知っているとがelementName我々が照会ので、照会し、この長いを取ることではないが、我々はわからないべきだと思います。うまくいけば、Hbaseがどのようにクエリを実行しているかを知ることができるので、スキーマを再設計するか、または行キーをやり直す必要があるか、速度に影響を与える現在格納されているデータ量です。
更新:要素のリストの時間範囲を照会します。 hbaseの要素のデータは1分に1回保存されます。スキャンを実行すると、1時間または1日間スキャンすることができます。 私は、スキャン時にそのブロックをスキャンすることをデバッグメッセージから確認できます。ここで
e.g. hash_elementName_timestamp. timestamp is a 10 digit epoch time
hash = murmur3_128 hash function of the element name
154_eee_0000000000
154_eee_0000000060
154_eee_0000000120
...
..
154_eee_0000003600
167_aaa_0000000000
167_aaa_0000000060
...
...
167_aaa_0000003600
は、私たちのスキャン方法からコードスニペットです:
public Map<String,String> scan(String name, String columnFamilyName, String columnName, long start, long end,
boolean reversed, int limit) throws IOException {
Map<String,String> m = new LinkedHashMap<String,String>();
Table table = null;
ResultScanner scanner = null;
try {
String hash = makeHash(name,fType.getNumberOfRegion());
String key = hash + "_" + name +"_";
Scan scan;
if (reversed) {
//swap the start and end keys when reversed
scan = new Scan(Bytes.toBytes(key + end),Bytes.toBytes(key + start));
scan.setReversed(true);
} else {
scan = new Scan(Bytes.toBytes(key + start),Bytes.toBytes(key + end));
}
scan.addColumn(Bytes.toBytes(columnFamilyName), Bytes.toBytes(columnName));
table = fCconnection.getTable(fTablename);
scanner = table.getScanner(scan);
int count = 0;
for (Result result = scanner.next(); result != null; result = scanner.next()) {
//if a limit was set, then only scan until we hit the limit
if (limit > 0 && count > limit) {
break;
}
m.put(Bytes.toString(result.getRow()), Bytes.toString((result.getValue(Bytes.toBytes(columnFamilyName), Bytes.toBytes(columnName)))));
count++;
}
私の限られた知識によれば、hbaseには 'explain'はありません。「Wide Column Store」であるCassandraもこの機能を備えています:http://www.datastax.com/dev/ blog/tracing-in-cassandra-1-2 –