A method, comprising: receiving, at a first coordinator server storing a shard and one or more participant servers (150,160) in a distributed system, a request to commit a transaction; receiving a notification (610, 620) from each of the participant servers, the notification including a respective prepared timestamp, the respective prepared timestamp being chosen within a time range for which the respective participant server obtained at least one lock; computing a commit timestamp for the transaction equal or greater than each of the prepared timestamps by: computing, at the first coordinator server, a hash value of a transaction ID of the transaction; setting a predetermined number of lower bits of the commit timestamp to be equal to the hash value of the transaction ID; computing, at the first coordinator server a maximum of all the prepared timestamps the first coordinator server received from each of the participant servers of the request and any commit timestamps the first coordinator server has previously assigned to other transactions; computing next timestamps higher than the maximum that also have the lower bits equal to the hash value; and restricting the commit timestamp for the transaction to the computed next timestamps; wherein the method further comprises: preventing a second coordinator server storing a second shard sharing at least one of the participant servers for one or more other transactions at a shared shard from selecting the same commit timestamp corresponding to the same hash value for any of the other transactions; and committing, at the coordinator server and each of the participant servers (150, 160), the transaction at the restricted commit timestamp. receiving, at a first coordinator server storing a shard and one or more participant servers (150,160) in a distributed system, a request to commit a transaction; receiving a notification (610, 620) from each of the participant servers, the notification including a respective prepared timestamp, the respective prepared timestamp being chosen within a time range for which the respective participant server obtained at least one lock; computing a commit timestamp for the transaction equal or greater than each of the prepared timestamps by: computing, at the first coordinator server, a hash value of a transaction ID of the transaction; setting a predetermined number of lower bits of the commit timestamp to be equal to the hash value of the transaction ID; computing, at the first coordinator server a maximum of all the prepared timestamps the first coordinator server received from each of the participant servers of the request and any commit timestamps the first coordinator server has previously assigned to other transactions; computing next timestamps higher than the maximum that also have the lower bits equal to the hash value; and restricting the commit timestamp for the transaction to the computed next timestamps; computing, at the first coordinator server, a hash value of a transaction ID of the transaction; setting a predetermined number of lower bits of the commit timestamp to be equal to the hash value of the transaction ID; computing, at the first coordinator server a maximum of all the prepared timestamps the first coordinator server received from each of the participant servers of the request and any commit timestamps the first coordinator server has previously assigned to other transactions; computing next timestamps higher than the maximum that also have the lower bits equal to the hash value; and restricting the commit timestamp for the transaction to the computed next timestamps; wherein the method further comprises: preventing a second coordinator server storing a second shard sharing at least one of the participant servers for one or more other transactions at a shared shard from selecting the same commit timestamp corresponding to the same hash value for any of the other transactions; and committing, at the coordinator server and each of the participant servers (150, 160), the transaction at the restricted commit timestamp. preventing a second coordinator server storing a second shard sharing at least one of the participant servers for one or more other transactions at a shared shard from selecting the same commit timestamp corresponding to the same hash value for any of the other transactions; and committing, at the coordinator server and each of the participant servers (150, 160), the transaction at the restricted commit timestamp.