DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Nested Transactions in CockroachDB 20.1

4 years ago dzone.com
Nested Transactions in CockroachDB 20.1

Summary: This is a summary of an article originally published by the source. Read the full original article here →

CockroachDB 20.1 introduces support for nested transactions, a SQL feature which simplifies the work of programmers of certain client applications. In this post, we'll explore when and where to use nested transactions, when not to use them, and how they work in a distributed environment.

In this section, we ignore the special meaning that CockroachDB was giving these statements prior to v20.1 (this is covered later below) and instead consider how they work for nested transactions.

This is done in CockroachDB by allocating a unique internal token for each nested transaction, and then mapping client-provided names to the internal tokens using a stack data structure.

In that world of best practices, there is little need for nested transactions, and that is a good thing.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com