一个有关聚合查询的问题(A problem about aggregation query) #3907
-
为了对部分字段进行索引,我将索引的值存储为LayerName。比如下面这个profile_task_segment_snapshot表(见Figure 1),它有6个字段,分别是id, sequence, dump_time, stack_binary, task_id, segment_id。我将它的id的值作为path的一部分,以实现索引的效果。最终同一个表的数据被分散到多个device中。 当我需要查询sequence的最大值时,我必须同时使用聚合函数 当我需要查询在所有segment_id为某个值的数据中sequence的最大值时,我必须使用 接着我尝试了 请问还有别的查询可以满足我的需求的吗?不然我只能 OS: Win10, Version: 0.12.2 In order to index some fields, I store the value of the index as LayerName. For example, there is a table called profile_task_segment_snapshot (See Figure 1). It has 6 fields: id, sequence, dump_time, stack_binary, task_id, segment_id. I make the value of id as part of the storage path to achieve the effect of index. Eventually the data from the same table is spread across multiple devices. When I need to query the max value of sequence, I must use aggregation function When I need to query the max value of sequence in all data whose segment_id is a certain value, I must use Then I tried Is there any other query that can meet my needs? Otherwise I can only use OS: Win10, Version: 0.12.2 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello, thank you for your question. I have encountered this problem before and communicated with the people in the community. It is difficult to support align by device and group by level together. The result set of align by device is in the form of a relational table with device and time as the primary key, while group by level is suitable for the IoTDB tree structure data model. The two are not compatible in themselves. If such a situation is supported, the original align by device semantics will be violated, and the resulting set will have no device column. Therefore, they do not agree with the implementation of group by level in align by device. You can get the value of the aggregate function and manually traverse it again, which is also implemented inside IoTDB. |
Beta Was this translation helpful? Give feedback.
Hello, thank you for your question. I have encountered this problem before and communicated with the people in the community. It is difficult to support align by device and group by level together. The result set of align by device is in the form of a relational table with device and time as the primary key, while group by level is suitable for the IoTDB tree structure data model. The two are not compatible in themselves. If such a situation is supported, the original align by device semantics will be violated, and the resulting set will have no device column. Therefore, they do not agree with the implementation of group by level in align by device. You can get the value of the aggregate …