Skip to content

Speed up MySQL and PostgreSQL per-test database isolation - #253

Open
rieske wants to merge 1 commit into
mainfrom
perf/mysql-postgres-test-speedups
Open

Speed up MySQL and PostgreSQL per-test database isolation#253
rieske wants to merge 1 commit into
mainfrom
perf/mysql-postgres-test-speedups

Conversation

@rieske

@rieske rieske commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • MySQL: cache the migrated schema dump once and restore via JDBC (allowMultiQueries) instead of docker exec + shell for every test database; add test-oriented mysqld flags (skip-log-bin, performance-schema=OFF, skip-name-resolve, higher connection/table caches).
  • PostgreSQL: use CREATE DATABASE … STRATEGY file_copy on PostgreSQL 15+ (gated by image major version so older versions such as 14.x keep working).
  • Shared: drop per-method databases asynchronously so cleanup does not block the next test, and demote per-clone INFO logs to DEBUG under parallel execution.

Local DATABASE_PER_TEST_METHOD FastTests benchmarks (100× three cases, parallel) showed roughly ~38% lower wall / ~48% lower avg for MySQL and ~10% / ~19% for PostgreSQL versus the previous baseline. Correctness suites (state guarantees, multi-database including PG 14.7) still pass.

Test plan

  • :mysql:test --tests '*StateGuarantee*' --tests '*MySQLTest*'
  • :postgresql:test --tests '*StateGuarantee*' --tests '*lifecycle*' --tests '*MultiDatabase*'
  • CI full :mysql:test and :postgresql:test (incl. performance suites)
  • Spot-check that seed data in Flyway migrations still appears in cloned DBs (full dump, not --no-data)

@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

MySQL clones now restore a cached dump over JDBC instead of docker exec,
with test-oriented server flags. PostgreSQL uses STRATEGY file_copy when
supported (15+). Shared per-method drops run asynchronously and hot-path
clone logs are demoted to DEBUG to reduce parallel-test overhead.
@rieske
rieske force-pushed the perf/mysql-postgres-test-speedups branch from 4c79951 to 80b5873 Compare July 20, 2026 07:11
@rieske rieske self-assigned this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant