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

相同结果集 子表查询和超级表查询效率有明显差距 #27938

Closed
Miracle1003 opened this issue Sep 18, 2024 · 2 comments
Closed
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@Miracle1003
Copy link

通过子表查询:
select * from temp_12408 where ts > '2024-09-01 00:00:00' order by ts desc;
执行时间在0.2s左右

通过超级表查询:
select * from vibration_ts where sensor_id = 12408 and data_type = 'temp' and ts > '2024-09-01 00:00:00' order by ts desc;
执行时间在0.5s左右

如果有数据碎片,超级表查询的执行时间还会被无限拉长。
这种现象是语句问题还是本身设计如此?

@Miracle1003 Miracle1003 added help wanted Extra attention is needed question Further information is requested labels Sep 18, 2024
@yu285
Copy link
Contributor

yu285 commented Sep 19, 2024

子表才是存储数据的实体,如果通过超级表查询,需要检索到子表然后返回数据。因此本来就多出一层筛选,有性能损耗是正常的。

@yu285 yu285 closed this as completed Sep 19, 2024
@Miracle1003
Copy link
Author

如果超级表或者子表数据量增加,是否会导致执行时间差距变大

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants