Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
329b76ed
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
329b76ed
编写于
10月 09, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17236 from taosdata/feature/3_liaohj
enh(query): optimize the perf for ordinary table query
上级
ba912cdf
5402f6bc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
9 deletion
+24
-9
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+24
-9
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
329b76ed
...
...
@@ -235,8 +235,13 @@ static int32_t binarySearchForStartRowIndex(uint64_t* uidList, int32_t num, uint
}
}
static
bool
queryChildTable
(
uint64_t
suid
)
{
return
suid
!=
0
;
}
int32_t
tLDataIterOpen
(
struct
SLDataIter
**
pIter
,
SDataFReader
*
pReader
,
int32_t
iStt
,
int8_t
backward
,
uint64_t
suid
,
uint64_t
uid
,
STimeWindow
*
pTimeWindow
,
SVersionRange
*
pRange
,
SSttBlockLoadInfo
*
pBlockLoadInfo
)
{
uint64_t
uid
,
STimeWindow
*
pTimeWindow
,
SVersionRange
*
pRange
,
SSttBlockLoadInfo
*
pBlockLoadInfo
,
const
char
*
idStr
)
{
int32_t
code
=
0
;
*
pIter
=
taosMemoryCalloc
(
1
,
sizeof
(
SLDataIter
));
if
(
*
pIter
==
NULL
)
{
...
...
@@ -252,15 +257,22 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
(
*
pIter
)
->
timeWindow
=
*
pTimeWindow
;
(
*
pIter
)
->
pBlockLoadInfo
=
pBlockLoadInfo
;
if
(
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
)
==
0
)
{
size_t
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
if
(
size
==
0
)
{
int64_t
st
=
taosGetTimestampUs
();
code
=
tsdbReadSttBlk
(
pReader
,
iStt
,
pBlockLoadInfo
->
aSttBlk
);
if
(
code
)
{
goto
_exit
;
}
else
{
size_t
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
SArray
*
pTmp
=
taosArrayInit
(
size
,
sizeof
(
SSttBlk
));
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SSttBlk
*
p
=
taosArrayGet
(
pBlockLoadInfo
->
aSttBlk
,
i
);
}
// only apply to the child tables, ordinary tables will not incur this filter procedure.
if
(
queryChildTable
(
suid
))
{
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
SArray
*
pTmp
=
taosArrayInit
(
size
,
sizeof
(
SSttBlk
));
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SSttBlk
*
p
=
taosArrayGet
(
pBlockLoadInfo
->
aSttBlk
,
i
);
if
(
p
->
suid
==
suid
)
{
taosArrayPush
(
pTmp
,
p
);
}
...
...
@@ -269,9 +281,12 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
taosArrayDestroy
(
pBlockLoadInfo
->
aSttBlk
);
pBlockLoadInfo
->
aSttBlk
=
pTmp
;
}
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
tsdbDebug
(
"load the last file info completed, elapsed time:%.2fms, %s"
,
el
,
idStr
);
}
size
_t
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
// find the start block
(
*
pIter
)
->
iSttBlk
=
binarySearchForStartBlock
(
pBlockLoadInfo
->
aSttBlk
->
pData
,
size
,
uid
,
backward
);
...
...
@@ -493,7 +508,7 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead
for
(
int32_t
i
=
0
;
i
<
pFReader
->
pSet
->
nSttF
;
++
i
)
{
// open all last file
struct
SLDataIter
*
pIter
=
NULL
;
code
=
tLDataIterOpen
(
&
pIter
,
pFReader
,
i
,
pMTree
->
backward
,
suid
,
uid
,
pTimeWindow
,
pVerRange
,
&
pMTree
->
pLoadInfo
[
i
]);
code
=
tLDataIterOpen
(
&
pIter
,
pFReader
,
i
,
pMTree
->
backward
,
suid
,
uid
,
pTimeWindow
,
pVerRange
,
&
pMTree
->
pLoadInfo
[
i
]
,
pMTree
->
idStr
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_end
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录