所有表:
select TABLE_NAME, concat(truncate(data_length/1024/1024,2),’ MB’) as data_size, concat(truncate(index_length/1024/1024,2),’ MB’) as index_size from information_schema.tables where TABLE_SCHEMA = ‘test’ group by TABLE_NAME order by data_length desc;
单表:
select TABLE_NAME, concat(truncate(data_length/1024/1024,2),’ MB’) as data_size, concat(truncate(index_length/1024/1024,2),’ MB’) as index_size from information_schema.tables where TABLE_SCHEMA = ‘Test’ group by TABLE_NAME order by data_length desc;
private int GetRTDataByTagNameAsyn(String tagName, TagData tagData) {
if (tagName.length() >= TAGNAME_LENGTH) {
logger.error("查询实时数据的点名长度过长:" + tagName);
return STATUS_PARAM_INVALID;
}
RTDBInterfaceLibrary clib = RTDBInterfaceLibrary.SYNC_INSTANCE;
Pointer cTagName = new Memory(tagName.getBytes().length + 1);
cTagName.setString(0, tagName);
RTDBImpl.RTDBInterfaceLibrary.TagData cTagData = new RTDBImpl.RTDBInterfaceLibrary.TagData();
int result = STATUS_INVOKE_FAILED;
try {
Date s = new Date();
result = clib.GetRTDataByTagName(cTagName, cTagData);
Date e = new Date();
if(logger.isInfoEnabled()){
logger.info("查询测点的实时数据耗时:" + (e.getTime() - s.getTime()) + "ms.[" + tagName + "]");
}
if (result != RTDBImpl.STATUS_OK) {
logger.warn("查询测点的实时数据失败! Return:[" + RTDBDaoHelper.getStringStatus(result) + "],[tagName=" + tagName + "]");
} else if (logger.isInfoEnabled()) {
logger.info("查询测点的实时数据成功![" + tagName + "]");
}
if (result == RTDBImpl.STATUS_OK) {
tagData.setValue(cTagData.value);
// must use long variable
NativeLong nl = cTagData.time;
long time = (nl).longValue();
tagData.setTime(new Date(time * 1000));
int status = cTagData.status;
tagData.setStatus(status);
if (logger.isDebugEnabled()) {
logger.debug("查询测点的实时数据成功! [" + tagName + "]" + tagData);
}
}
} catch (Exception e) {
logger.error("查询测点的实时数据异常[" + tagName + "]:" + e.getLocalizedMessage());
if (logger.isDebugEnabled()) {
logger.debug("查询测点的实时数据异常[" + tagName + "]", e);
}
} finally {
long cTagNamePeer = Pointer.nativeValue(cTagName);
Native.free(cTagNamePeer);
Pointer.nativeValue(cTagName, 0);
}
return result;
}