[
https://issues.apache.org/jira/browse/IOTDB-3456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553241#comment-17553241
]
Jialin Qiao commented on IOTDB-3456:
------------------------------------
We could support two interfaces in PathPatternTree, letting the checking in the
query not impact write performance.
For write: addDeduplicatedPath(String, devices, List<String> measurements)
For query: addMayDuplicatedPath(PartialPath path)
(1) In the insertion, we could build a PathPatternTree without checking if the
path already exists.
1.1 For InsertNode, we could directly build the PathPatternTree, construct node
for the device, then for each measurement.
1.2 For BatchInsertNode, to avoid fetch schema multiple times, we'd better
merge the List<Device> and List<Measurements> first, then, build the
PathPatternTree.
For example,
insert into root.sg.d1(time, s1, s2)
insert into root.sg.d1(time, s1, s2)
insert into root.sg.d1(time, s1, s3)
insert into root.sg.d2(time, s1, s2)
Currently, we need to fetch from SchemaCache and build PathPatternTree (need
deduplication) 4 times.
We could first get d1 -> \{s1, s2, s3}, d2 -> \{s1, s2}, then fetch from
SchemaCache and build the PathPatternTree (without deduplication).
(2) For query, it is more duplicated, we may meet "select s1, * \{*}from
root.sg.d1, root.sg.**{*}",
This will create
root.sg.d1.s1
root.sg.d1.*
root.sg.**.*
root.sg.**.s1
The * and ** will replace the existed measurements.
We could build the Tree for each path, and check if it is * and ** in each
level.
> Optimize PathPattarnTree
> ------------------------
>
> Key: IOTDB-3456
> URL: https://issues.apache.org/jira/browse/IOTDB-3456
> Project: Apache IoTDB
> Issue Type: Improvement
> Reporter: Minghui Liu
> Priority: Major
>
> Now, when calling {_}appendPath(path){_}, we just add the path to a list, and
> then we need to call _constructTree()_ to trigger building a tree from the
> list.
>
> It is best to build a tree directly when calling {_}appendPath(path){_}.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)