Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Kudu increment update support

avatar
New Contributor

hi,

Dose Kudu support  increment update?

 

For example, we have a table with two field, browser and visit count :

borwser   visitCount

firfox        10

 

And then, we got a new visit from firfox, the table will be update to:

borwser   visitCount

firfox        11

 

we want to do this update by increment operation, ranther then read the visitCount, add one and write it back.

 

Thanks in advance.

1 ACCEPTED SOLUTION

avatar
Expert Contributor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
5 REPLIES 5

avatar
Expert Contributor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Explorer
Hi, We also found Increment as a very useful operation in production. It can reduce row number. So why increment is not supported, is it on the plan?

avatar

I think it is just because how Kudu is implemented. The visit count is not the primary key of the table. Nor the browser column. For atomic incrementing you have to have the data in one location on one server.

avatar
New Contributor

"Nor the browser column" -- What if the "browser" column WAS the primary key?  Would increment be possible in similar fashion to upsert, the difference being that internally Kudu would read the existing value and add it to the increment value before saving?  

avatar
Expert Contributor

@hindog wrote:

"Nor the browser column" -- What if the "browser" column WAS the primary key?  Would increment be possible in similar fashion to upsert, the difference being that internally Kudu would read the existing value and add it to the increment value before saving?  



The other Kudu limitation that this runs into is that row key columns cannot be modified. It would be somewhat easier to implement atomic increments on non-key columns, but then that means doing a lot of updates and it's not something Kudu excels at e.g. it supports modifying data but the higher the rate the slower the reads are.