Skip to content

Update SQLAlchemy docs to remove incorrect info that SAVEPOINT is faster #6390

@rmloveland

Description

@rmloveland

In the Build a Python app with SQLAlchemy docs we say re: the run_transaction() wrapper method that:

It will run your transactions to completion much faster than a naive implementation that created a fresh transaction after every retry error. Because of the way the CockroachDB dialect's driver structures the transaction attempts (using a SAVEPOINT statement under the hood, which has a slightly different meaning in CockroachDB than in some other databases), the server is able to preserve some information about the previously attempted transactions to allow subsequent retries to complete more easily.

This is not actually correct. Using an application-level retry loop that does not use SAVEPOINT is basically fine most of the time, and performs well if you add exponential backoff.

For context see the discussion in this mailing list thread, and also cockroachdb/cockroach#5935

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions