Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于预计算的疑问,建表时添加字段进sma反而计算会更慢 #27014

Open
pancodex opened this issue Aug 6, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@pancodex
Copy link

pancodex commented Aug 6, 2024

Bug Description
两个库中均有1个超级表meters,超级表有1万张子表,每张子表10万条数据,共计10亿条数据。
其中test库的meters设置为将所有字段加入sma;
`taos> show create table test.meters \G;

*************************** 1.row ***************************
Table: meters
Create Table: CREATE STABLE meters (ts TIMESTAMP ENCODE 'delta-i' COMPRESS 'lz4' LEVEL 'medium', current FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium', voltage INT ENCODE 'simple8b' COMPRESS 'lz4' LEVEL 'medium', phase FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium', temperture FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium', humidity FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium') TAGS (groupid TINYINT, location VARCHAR(16)) SMA(current,voltage,phase,temperture,humidity)
`

test_nosma库的meters建表sql和test库的超表除去sma外完全相同;
`taos> show create table test_nosma.meters \G;

*************************** 1.row ***************************
Table: meters
Create Table: CREATE STABLE meters (ts TIMESTAMP ENCODE 'delta-i' COMPRESS 'lz4' LEVEL 'medium', current FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium', voltage INT ENCODE 'simple8b' COMPRESS 'lz4' LEVEL 'medium', phase FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium', temperture FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium', humidity FLOAT ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium') TAGS (groupid TINYINT, location VARCHAR(16))
`

但实际测试每个字段的最小值、最大值和统计值,都是字段没加入sma的test_nosma库的查询速度最快
test_nosma库的查询速度:
image
test库的查询速度:
image

甚至加入sma的首次查询去到144秒,这和预期的完全相反。

比较了下vnode里.sma文件的大小,两个库的是基本一致
test_nosma:
image
test:
image

Expected Behavior
预期应该是test库的预计算更快。
是我的理解有误吗?建表语句这里的sma(column1, column2)实际上是将字段剔除出预计算?

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: CentOS-7
  • Memory, CPU, current Disk Space
  • 内存剩余12G、CPU16核,硬盘空间500G
  • TDengine 3.3.1

Additional Context
部署的3节点集群

@pancodex pancodex added the bug Something isn't working label Aug 6, 2024
@yu285
Copy link
Contributor

yu285 commented Aug 13, 2024

我们看一下

@yu285
Copy link
Contributor

yu285 commented Aug 13, 2024

您方便加一下微信吗,方便后续联系 a15652223354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants