[ https://issues.apache.org/jira/browse/ASTERIXDB-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16093542#comment-16093542 ]
Yingyi Bu commented on ASTERIXDB-1922: -------------------------------------- +1 for this proposal. One thing we can do is that instead of checking that the 2ndary key doesn't change, we in addition check if the existing tuple comes from the current in-memory component in use. Of course, the optimization will becomes less useful when the in-memory component size is set smaller. > Change the behavior of Upsert on secondary index for component correlation > -------------------------------------------------------------------------- > > Key: ASTERIXDB-1922 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1922 > Project: Apache AsterixDB > Issue Type: Improvement > Reporter: Chen Luo > Priority: Minor > > Currently, when we upsert a tuple, the secondary index is modified by > comparing the old secondary key and the new secondary key. If they are > exactly the same, then do nothing. Otherwise, we delete the (old secondary > key, primary key) pair, and insert the (new secondary key, primary key) pair. > However, this behavior is not suitable if we want to make disk components of > the primary index and secondary indexes correlated. The end goal is that each > disk component of the secondary key should correspond to one disk component > of the primary key. With this property, after we get a list of primary keys > from the secondary index, we only need to search one disk component of the > primary index for each primary key, which would greatly reduce the time for > point lookups. > In order for the above optimization to work, the upsert should always delete > the (old secondary key, primary key) pair (unless the primary key is inserted > for the first time), and insert the (new secondary key, primary key) pair. -- This message was sent by Atlassian JIRA (v6.4.14#64029)