Very good proposal. However I don't see how the isolation is guaranteed between concurrent transactions in this proposal.
Let's say there is one row in the table k1 = 1, v1 = 1 There are two concurrent SQL executions, both of which execute the following statement "update my_table set v1 = v1 + 1 where k1 = 1" If both statements are executed successfully, the result should be k1 = 1, v1 = 3 I would like to ask what means you intend to ensure isolation between concurrent transactions. Thanks, Zhao Chun ling miao <lingm...@apache.org> 于2021年1月20日周三 下午3:51写道: > Hi Zhengguo, > > This is a very valuable feature. > > Before Doris supports syntax of update, although Doris can also update data > indirectly through the uniq model, it is very cumbersome to use. > The user is required to retain the full amount of new data. > > If necessary, I have a better understanding of the query layer, and I can > do development to support the update function. > > Ling Miao > > 寒江雪 <yangz...@gmail.com> 于2021年1月20日周三 下午3:14写道: > > > ## Background > > > > The current Doris table does not support the update operation, but there > > are many scenarios where the data needs to be updated. Due to the batch > > delete function we implemented before, it paved the way for the update. > > > > ## Syntax > > > > We only support single table update > > > > ``` > > UPDATE table_name > > SET assignment_list > > [WHERE where_condition] > > [ORDER BY...] > > [LIMIT row_count] > > > > value: > > {expr | DEFAULT} > > > > assignment: > > col_name = value > > > > assignment_list: > > assignment [, assignment]. > > ``` > > > > ## Design > > > > There are two kinds of updates involved here, one that only contains the > > value column, and the other that contains the key column. > > > > * Include and update of value column > > > > This method is relatively simple. You only need to plan the update > > statement into a query plan like `select * from table insert into table` > > during query planning, and you need to add an update node to modify the > > data to the updated value, or plan Into a statement similar to `select a, > > b,'xx','xx1' from table insert into table` and hand it directly to the > > tableSink node > > > > * Contains the update of the key column > > > > This kind of relatively complicated, we need to divide the query into > two > > parts, and need to use the MERGE semantics in the batch delete, first > plan > > it into a query plan similar to `select * from table insert into table`, > > and then generate it first for the modification of the key column One > piece > > of data that needs to be deleted, and then replace the value of the key > > column to generate new data that needs to be added, mainly generating two > > pieces of imported data from one piece of original data. Need update node > > to have the ability to repeat data > > > > ## Subtasks > > > > 1. Add index to unique table value column to speed up data scanning > > 2. FE supports update statements and generates corresponding query plans. > > Be implements update node, which can be divided into two parts here > > 1. Support updates that only contain the value column > > 2. Support the update of the key column > > >