These errors can also arise due to time uncertainty. Note that using SELECT FOR UPDATE does not completely eliminate the chance of serialization errors, which use the SQLSTATE error code 40001, and emit error messages with the string restart transaction. By preventing thrashing, CockroachDB also prevents transaction retries that would otherwise occur.Īs a result, using SELECT FOR UPDATE leads to increased throughput and decreased tail latency for contended operations. These other transactions are effectively put into a queue based on when they tried to read the value of the locked rows.īecause this queueing happens during the read operation, the thrashing that would otherwise occur if multiple concurrently executing transactions attempt to SELECT the same data and then UPDATE the results of that selection is prevented. It works by locking the rows returned by a selection query, such that other transactions trying to access those rows are forced to wait for the transaction that locked the rows to finish. The SELECT FOR UPDATE statement is used to order transactions by controlling concurrent access to one or more rows of a table.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |