Forum Stats

  • 3,816,896 Users
  • 2,259,247 Discussions
  • 7,893,584 Comments

Discussions

question regarding db lock

Eric Jing
Eric Jing Member Posts: 24 Green Ribbon

Dear sir,

 

Suppose below is the team table:

CREATE TABLE if not exists teamTable

(

    teamid integer GENERATED BY DEFAULT AS IDENTITY

(START WITH 1 INCREMENT BY 1),

    users array(record(name string, userid integer)),

primary key (teamid)

)

 

And suppose there are 2 db requests inserting new users into the same team (with same teamid) at the same time. Does it mean that query 2 cannot been done only until query 1 is finished? If the nosql db is functioning as what I mentioned above, it will reduce it’s write performance if a lot of query want to write/insert/update some data into the same array element at the same time (which below to the same row with the same primary key), and the same applies to the “map”.

So, regarding this, does oracle nosql db has a row lock mechanism similar to oracle database? Thank you.

Answers

  • Gmfeinberg-Oracle
    Gmfeinberg-Oracle Posts: 1,333 Employee

    Hi,

    A few points here and a question...

    1. Given the use of an IDENTITY column as your primary key, unless you force the issue by manually assigning teamid you cannot insert 2 new rows with the same teamid.
    2. If you have 2 threads/processes trying to update the same row (same teamid) at the same time one of them will win but the performance will not be significantly impacted. Oracle NoSQL has single-digit latency for single-row operations, conflicting or not.
    3. The semantics of Oracle NoSQL include row level locking, but as mentioned above, the transactions for single-row updates are extremely fast and locks are held for a brief period in order to guarantee single digit latencies

    The question: are you seeing a specific problem or are your questions theoretical?