Does TiKV need to GET the vote corresponding to the name first and then PUT it back when executing a statement like UPDATE vote_table SET votes=votes+1 where name = ? Is there a better way?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 执行这样的语句UPDATE vote_table SET votes=votes+1 where name = ? tikv是不是要先把name对应的vote GET下来再PUT回去?有更好的做法吗

| username: TiDBer_khgxEtEV

SQL execution

| username: 小龙虾爱大龙虾 | Original post link

There’s no good solution; transactions exist in TiDB’s memory and are written to TiKV upon submission.

| username: tidb菜鸟一只 | Original post link

No, that’s just how TiKV’s logic works.

| username: zhaokede | Original post link

The SQL logic is like this.

| username: 随缘天空 | Original post link

It is better to use primary key conditions when updating, as it will be more efficient.

| username: Jack-li | Original post link

There is no better way, it’s fixed logic.

| username: 小于同学 | Original post link

There shouldn’t be any.