skytable / skytable

Skytable is a modern scalable NoSQL database with BlueQL, designed for performance, scalability and flexibility. Skytable gives you spaces, models, data types, complex collections and more to build powerful experiences

Home Page:https://skytable.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Batch implementations

ohsayan opened this issue · comments

Batches are a way to group together queries and we will support various types of batches (including transactional ones). This issue tracks these implementations:

  • #332
  • Transaction (ACID, design TBD)

If you have any ideas, leave a comment here.

for task like this:

CREATE MODEL myspace.user_model(user_id: int, groups: list { type: int })
CREATE MODEL myspace.group_model(group_id: int, password: string, users: list { type: int })

add user into group will require transaction,

UPDATE user_model SET groups += "group_id" WHERE user_id = '1'
UPDATE group_model SET users += "user_id" WHERE group_id = '1'

You want avoid the case first is done but the other failed. this need to be run in batch and atomic.

And some case like this:

if count( user_model.groups ) < 10 and user_model.status == good and  count( group_model.users ) < 10  and group_model.status == good   {
 UPDATE user_model SET groups += "group_id" WHERE user_id = '1'
 UPDATE group_model SET users += "user_id" WHERE group_id = '1'
}

Some solution like redis lua script.

update 2 entities at once will be good enough.