提交 eec58b8e 编写于 作者: wmmhello's avatar wmmhello

opti:use suid+uid->tags index to optimize time cost

上级 95ef68bb
...@@ -1425,6 +1425,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) { ...@@ -1425,6 +1425,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) {
} }
void colDataDestroy(SColumnInfoData* pColData) { void colDataDestroy(SColumnInfoData* pColData) {
if(!pColData) return;
if (IS_VAR_DATA_TYPE(pColData->info.type)) { if (IS_VAR_DATA_TYPE(pColData->info.type)) {
taosMemoryFreeClear(pColData->varmeta.offset); taosMemoryFreeClear(pColData->varmeta.offset);
} else { } else {
......
...@@ -87,7 +87,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) { ...@@ -87,7 +87,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
} }
// open pCtbIdx // open pCtbIdx
ret = tdbTbOpen("ctb.idx", sizeof(SCtbIdxKey), 0, ctbIdxKeyCmpr, pMeta->pEnv, &pMeta->pCtbIdx); ret = tdbTbOpen("ctb.idx", sizeof(SCtbIdxKey), -1, ctbIdxKeyCmpr, pMeta->pEnv, &pMeta->pCtbIdx);
if (ret < 0) { if (ret < 0) {
metaError("vgId:%d, failed to open meta child table index since %s", TD_VID(pVnode), tstrerror(terrno)); metaError("vgId:%d, failed to open meta child table index since %s", TD_VID(pVnode), tstrerror(terrno));
goto _err; goto _err;
......
...@@ -385,7 +385,9 @@ SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray* uidLi ...@@ -385,7 +385,9 @@ SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray* uidLi
} }
int32_t rows = taosArrayGetSize(uidList); int32_t rows = taosArrayGetSize(uidList);
if(rows == 0){
goto end;
}
int64_t stt1 = taosGetTimestampUs(); int64_t stt1 = taosGetTimestampUs();
qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt); qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt);
...@@ -397,8 +399,7 @@ SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray* uidLi ...@@ -397,8 +399,7 @@ SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray* uidLi
int64_t st = taosGetTimestampUs(); int64_t st = taosGetTimestampUs();
for (int32_t i = 0; i < rows; i++) { for (int32_t i = 0; i < rows; i++) {
uint64_t* uid = taosArrayGet(uidList, i); void* tag = taosArrayGetP(tags, i);
void* tag = taosArrayGet(tags, i);
// int64_t stt = taosGetTimestampUs(); // int64_t stt = taosGetTimestampUs();
// int64_t stt1 = taosGetTimestampUs(); // int64_t stt1 = taosGetTimestampUs();
// qDebug("generate tag get meta rows:%d, cost:%ld ms", rows, stt1-stt); // qDebug("generate tag get meta rows:%d, cost:%ld ms", rows, stt1-stt);
...@@ -498,16 +499,18 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, ...@@ -498,16 +499,18 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
} }
int32_t i = 0; int32_t i = 0;
while (i < taosArrayGetSize(pListInfo->pTableList)) { while (i < taosArrayGetSize(res) && pColInfoData) {
void* var = POINTER_SHIFT(pColInfoData->pData, i * pColInfoData->info.bytes); void* var = POINTER_SHIFT(pColInfoData->pData, i * pColInfoData->info.bytes);
if (*(bool*)var == false) { if (*(bool*)var == false) {
taosArrayRemove(pListInfo->pTableList, i); taosArrayRemove(res, i);
continue; continue;
} }
i++; i++;
} }
colDataDestroy(pColInfoData); colDataDestroy(pColInfoData);
}else{
vnodeGetCtbIdList(pVnode, pScanNode->suid, res);
} }
for (int i = 0; i < taosArrayGetSize(res); i++) { for (int i = 0; i < taosArrayGetSize(res); i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册