Skip to main content

Drivers

Queen supports several databases, but the production contract is intentionally PostgreSQL-first.

Start with Support Matrix when comparing driver guarantees. Current limitations to keep in mind:

  • SQLite locking is for local/single-process use, not distributed coordination.
  • ClickHouse locking is best-effort; keep deployment migrators serialized.
  • CockroachDB retries 40001 serialization errors up to three times; Go callbacks must be retry-safe.
  • MySQL and ClickHouse record migration metadata separately from the body.

The detailed edge list lives in Known Limitations.

DatabaseDriver packageLockingTransaction behaviorMigration record atomic with body
PostgreSQLdrivers/postgresProduction-ready advisory lock pinned to one connectionYes by default; opt-in non-transactional commandsYes by default; recovery markers for non-transactional commands
MySQLdrivers/mysqlGET_LOCK basedDepends on MySQL DDL semanticsNo
SQLitedrivers/sqliteLocal/single-process use recommendedYes for transactional statementsYes
ClickHousedrivers/clickhouseBest-effort table guardNo true transaction supportNo
CockroachDBdrivers/cockroachdbTable row with expirySerializable transactions with bounded retriesYes
MSSQLdrivers/mssqlApplication lockYes for transactional statementsYes

PostgreSQL​

Use PostgreSQL when you need the strongest Queen behavior today:

  • advisory lock pinned to one connection;
  • SQL and Go-function migration body inside a transaction;
  • migration record written in the same transaction as the migration body;
  • pgxpool adapter support.
q := queen.New(postgres.New(db))

Detailed page: PostgreSQL Driver.

MySQL​

MySQL uses GET_LOCK on a pinned connection and normal database/sql transaction execution. DDL rollback behavior follows MySQL rules.

Detailed page: MySQL Driver.

SQLite​

SQLite is useful for tests, local tools, and single-process applications. Do not treat the current SQLite lock path as distributed coordination between multiple migrator processes.

Detailed page: SQLite Driver.

ClickHouse​

ClickHouse does not provide the same transaction model as PostgreSQL. Treat its migration lock as a best-effort guard and keep migrations operationally serialized.

Detailed page: ClickHouse Driver.

CockroachDB​

CockroachDB retries 40001 serialization failures up to three times. Go-function callbacks can run more than once and must be retry-safe; an error after the retry limit still needs operator review.

Detailed page: CockroachDB Driver.

MS SQL Server​

MSSQL uses sp_getapplock / sp_releaseapplock on a pinned session connection.

Detailed page: MS SQL Server Driver.