Database Engine Selection and Migration
Purpose
Make the accepted trade-offs and non-portable assumptions visible before an engine choice or
cutover. Start with vetoes and behavioral proof, not a weighted feature popularity score.
Decision inputs
read/write/admin SLOs, availability, RPO/RTO, retention, and growth:
OLTP/analytic/hybrid workload, data shape/distribution, working set, and peak concurrency:
transaction invariants and anomalies the domain permits or forbids:
topology, regions, replication/CDC, backup/restore, and failover requirements:
required SQL/types/extensions/indexes/search/JSON/partitioning/columnar capabilities:
JDK, ORM, pool, exact driver versions, batching/fetch/generated-key behavior:
edition/license/managed-service constraints and team operational competence:
DDL/cutover window, reversibility, data sovereignty, and exit cost:
If these are missing, produce the evidence plan rather than selecting a winner.
Inspect build/toolchain, resolved dependencies and runtime images for the actual JVM stack;
this skill declares no universal JDK/driver baseline. A recommendation does not authorize an
upgrade. Scope the evidence plan to missing decisive inputs, preserving conclusions already
supported by the available evidence.
Greenfield workflow
- Express hard vetoes as testable requirements. A required behavior that an allowed edition or
topology cannot provide eliminates an option; many small advantages do not cancel a veto.
- Write the domain's critical concurrent scenarios and run deterministic interleavings at the
intended isolation level. Isolation names are not portable behavior contracts.
- Use production-shaped volume, skew, correlations, transaction durations, and concurrency. Compare
work—reads/buffers, rows examined, spills, log/WAL, locks, and p99—not empty-schema averages.
- Exercise inevitable operations: vacuum/purge/version store, checkpoints, growth, replication lag,
backup/restore, failover, and a large DDL under concurrent traffic.
- Run the intended JVM stack. Drivers and poolers change prepared statements, plans, batch/fetch,
memory, timeout, session state, and generated-key behavior.
- Record the trade-off, risk signal, owner, mitigation, exit path, and event that reopens the ADR.
Migration workflow
- Inventory five surfaces separately: schema; SQL; concurrency; JVM integration; operations.
Schema conversion alone does not establish compatibility; schema and constraint mistakes
can be as consequential as SQL, concurrency or operational differences.
- Turn every source-specific behavior into an explicit destination invariant or an accepted change.
Do not transliterate hints, types, index syntax, isolation names, or driver properties.
- Compare source and destination using an anonymized edge-case corpus and production-shaped load.
Check result set, order, JDBC types, errors, plans, and work.
- Force concurrent interleavings for critical invariants and failure cases for DDL, partial loads,
restart, failover, lag, timeout, and generated keys.
- Shadow side-effect-free reads at comparable data boundaries and reconcile without erasing
duplicates or other contract differences. Dual-write only with explicit idempotency, ordering, failure handling,
and reconciliation; otherwise it creates two sources of truth.
- Cut over with measurable abort criteria, a bounded reconciliation window, rehearsed rollback, and
one owner authorized to decide. Fence old writers and verify destination application through
the final source commit boundary before admitting destination writes. Reversibility after
that point requires a proven path for every accepted destination write.
Non-portability rules
- Compare isolation by allowed outcomes and conflict handling, not labels. SQL Server locking/RCSI,
InnoDB consistent reads plus next-key locks, and PostgreSQL snapshot/SSI can block, abort, or admit
different interleavings under similarly named levels.
- Redesign physical keys and indexes for the destination. SQL Server clustered keys, InnoDB primary
keys, and PostgreSQL heap indexes amplify width and updates differently.
- Test nullable uniqueness, collations, case/accents/trailing spaces, identifiers, time zones/DST,
numeric overflow, booleans, UUID ordering, generated IDs, and
NULL semantics explicitly.
- Upsert, pagination, partial/expression indexes, covering, JSON, DDL transactions, and online DDL do
not have one-to-one translations.
- Replace driver and ORM settings by destination behavior. Similar property names do not imply the
same wire protocol, plan lifecycle, fetch streaming, batch rewrite, or timeout coverage.
- Operational competence is a requirement. A benchmark winner the team cannot back up, fail over,
observe, maintain, and recover under the target RTO is not a viable winner.
- Version and edition are part of every claim. A Developer/Enterprise lab can validate DDL that the
production edition rejects; a major version can invert defaults.
Output contract
For greenfield, produce an ADR with context, vetoes, measured scenarios, accepted trade-offs, risks
and owners, reversibility, and review trigger. For migration, produce a compatibility inventory,
evidence matrix, shadow/reconciliation plan, cutover/abort/rollback runbook, and unresolved risks.
Each decisive claim must identify evidence, inference, confidence reason, and the test that could
falsify it.
References
- Engine trade-offs — read when comparing the three engines or
defining proof-of-concept gates.
- Migration compatibility — read when inventorying a source
system or writing destination equivalence tests.
- Shadow and cutover — read when planning dual-run, reconciliation,
failure rehearsal, cutover, or rollback.
1---2name: database-engine-selection-and-migration3description: Choosing among SQL Server, MySQL/InnoDB, and PostgreSQL for a greenfield system, or planning a migration between them, from explicit semantic, workload, operational, JVM-driver, DDL, cost, and team constraints. Use when an ADR, proof of concept, compatibility inventory, shadow validation, or reversible cutover is needed. Not a generic product ranking or live query-tuning workflow.4---56# Database Engine Selection and Migration78## Purpose910Make the accepted trade-offs and non-portable assumptions visible before an engine choice or11cutover. Start with vetoes and behavioral proof, not a weighted feature popularity score.1213## Decision inputs1415```text16read/write/admin SLOs, availability, RPO/RTO, retention, and growth:17OLTP/analytic/hybrid workload, data shape/distribution, working set, and peak concurrency:18transaction invariants and anomalies the domain permits or forbids:19topology, regions, replication/CDC, backup/restore, and failover requirements:20required SQL/types/extensions/indexes/search/JSON/partitioning/columnar capabilities:21JDK, ORM, pool, exact driver versions, batching/fetch/generated-key behavior:22edition/license/managed-service constraints and team operational competence:23DDL/cutover window, reversibility, data sovereignty, and exit cost:24```2526If these are missing, produce the evidence plan rather than selecting a winner.27Inspect build/toolchain, resolved dependencies and runtime images for the actual JVM stack;28this skill declares no universal JDK/driver baseline. A recommendation does not authorize an29upgrade. Scope the evidence plan to missing decisive inputs, preserving conclusions already30supported by the available evidence.3132## Greenfield workflow33341. Express hard vetoes as testable requirements. A required behavior that an allowed edition or35 topology cannot provide eliminates an option; many small advantages do not cancel a veto.362. Write the domain's critical concurrent scenarios and run deterministic interleavings at the37 intended isolation level. Isolation names are not portable behavior contracts.383. Use production-shaped volume, skew, correlations, transaction durations, and concurrency. Compare39 work—reads/buffers, rows examined, spills, log/WAL, locks, and p99—not empty-schema averages.404. Exercise inevitable operations: vacuum/purge/version store, checkpoints, growth, replication lag,41 backup/restore, failover, and a large DDL under concurrent traffic.425. Run the intended JVM stack. Drivers and poolers change prepared statements, plans, batch/fetch,43 memory, timeout, session state, and generated-key behavior.446. Record the trade-off, risk signal, owner, mitigation, exit path, and event that reopens the ADR.4546## Migration workflow47481. Inventory five surfaces separately: schema; SQL; concurrency; JVM integration; operations.49 Schema conversion alone does not establish compatibility; schema and constraint mistakes50 can be as consequential as SQL, concurrency or operational differences.512. Turn every source-specific behavior into an explicit destination invariant or an accepted change.52 Do not transliterate hints, types, index syntax, isolation names, or driver properties.533. Compare source and destination using an anonymized edge-case corpus and production-shaped load.54 Check result set, order, JDBC types, errors, plans, and work.554. Force concurrent interleavings for critical invariants and failure cases for DDL, partial loads,56 restart, failover, lag, timeout, and generated keys.575. Shadow side-effect-free reads at comparable data boundaries and reconcile without erasing58 duplicates or other contract differences. Dual-write only with explicit idempotency, ordering, failure handling,59 and reconciliation; otherwise it creates two sources of truth.606. Cut over with measurable abort criteria, a bounded reconciliation window, rehearsed rollback, and61 one owner authorized to decide. Fence old writers and verify destination application through62 the final source commit boundary before admitting destination writes. Reversibility after63 that point requires a proven path for every accepted destination write.6465## Non-portability rules6667- Compare isolation by allowed outcomes and conflict handling, not labels. SQL Server locking/RCSI,68 InnoDB consistent reads plus next-key locks, and PostgreSQL snapshot/SSI can block, abort, or admit69 different interleavings under similarly named levels.70- Redesign physical keys and indexes for the destination. SQL Server clustered keys, InnoDB primary71 keys, and PostgreSQL heap indexes amplify width and updates differently.72- Test nullable uniqueness, collations, case/accents/trailing spaces, identifiers, time zones/DST,73 numeric overflow, booleans, UUID ordering, generated IDs, and `NULL` semantics explicitly.74- Upsert, pagination, partial/expression indexes, covering, JSON, DDL transactions, and online DDL do75 not have one-to-one translations.76- Replace driver and ORM settings by destination behavior. Similar property names do not imply the77 same wire protocol, plan lifecycle, fetch streaming, batch rewrite, or timeout coverage.78- Operational competence is a requirement. A benchmark winner the team cannot back up, fail over,79 observe, maintain, and recover under the target RTO is not a viable winner.80- Version and edition are part of every claim. A Developer/Enterprise lab can validate DDL that the81 production edition rejects; a major version can invert defaults.8283## Output contract8485For greenfield, produce an ADR with context, vetoes, measured scenarios, accepted trade-offs, risks86and owners, reversibility, and review trigger. For migration, produce a compatibility inventory,87evidence matrix, shadow/reconciliation plan, cutover/abort/rollback runbook, and unresolved risks.8889Each decisive claim must identify evidence, inference, confidence reason, and the test that could90falsify it.9192## References9394- [Engine trade-offs](references/engine-trade-offs.md) — read when comparing the three engines or95 defining proof-of-concept gates.96- [Migration compatibility](references/migration-compatibility.md) — read when inventorying a source97 system or writing destination equivalence tests.98- [Shadow and cutover](references/shadow-and-cutover.md) — read when planning dual-run, reconciliation,99 failure rehearsal, cutover, or rollback.