Database Migration Strategies: Functions
Module: Database-Specific Features
Migration tools and commands: (1) Export: mysqldump --all-databases > backup.sql (MySQL), pg_dump dbname > backup.sql (PostgreSQL), bcp (SQL Server). (2) Import: mysql < backup.sql (MySQL), psql dbname < backup.sql (PostgreSQL). (3) Schema conversion: pgloader (MySQL → PostgreSQL), ora2pg (Oracle → PostgreSQL), AWS Schema Conversion Tool. (4) Data sync: AWS DMS (Database Migration Service), Debezium (CDC), custom triggers. (5) Validation: SELECT COUNT(*), checksums, sample queries. (6) Monitoring: pg_stat_activity (PostgreSQL), SHOW PROCESSLIST (MySQL), sys.dm_exec_requests (SQL Server).
Schema conversion: AUTO_INCREMENT → SERIAL (PostgreSQL), IDENTITY (SQL Server), SEQUENCE (Oracle)
Data type mapping: DATETIME → TIMESTAMP, TINYINT → SMALLINT, ENUM → CHECK constraint
Export commands: mysqldump --single-transaction (MySQL), pg_dump (PostgreSQL), bcp (SQL Server)
Import commands: mysql < dump.sql (MySQL), psql < dump.sql (PostgreSQL), COPY (PostgreSQL bulk)
Validation: SELECT COUNT(*) (row counts), MD5/checksums (data integrity), sample queries (correctness)
CDC tools: Debezium (open source), AWS DMS (cloud), Maxwell (MySQL binlog), custom triggers
Monitoring: pg_stat_activity (PostgreSQL), SHOW PROCESSLIST (MySQL), sys.dm_exec_requests (SQL Server)
Tools: mysqldump, pgloader (to PostgreSQL), AWS DMS. Challenges: ENUM, AUTO_INCREMENT, case-insensitive
Tools: pg_dump, pg_restore, pgloader (from MySQL). Features: MVCC, arrays, JSONB, full-text search
Tools: bcp, SQL Server Migration Assistant. Features: T-SQL, IDENTITY, columnstore indexes
Tools: ora2pg, AWS Schema Conversion Tool. Challenges: PL/SQL, SEQUENCE, expensive licensing
Core references in this topic include Transaction, WHERE, =. Learn what each one does, when to use it, and the execution or engine rules that matter.
Transaction
Groups multiple writes into one safe unit so the database can commit all changes together or undo them together.
BEGIN; ... COMMIT;
Transactions are the operational backbone behind ACID behavior.
WHERE
Filters rows before projection and sorting. It decides which rows continue through the query pipeline.
SELECT ... FROM table WHERE condition;
Most performance issues start with a weak WHERE clause or a missing supporting index.
=
Returns rows where the left and right values are exactly equal.
column = value
Use with exact matches. Do not use = NULL.
<, >, <=, >=
Range comparison operators for less-than, greater-than, and inclusive boundary checks.
salary >= 80000
LIKE
Pattern-matching operator for wildcard string searches.
name LIKE 'Joh%'
ANY / ALL
Compares one value against every or at least one value from a subquery result.
salary > ALL (SELECT salary FROM interns)
TIMESTAMP
Stores date and time together, typically without timezone context.
TIMESTAMP '2026-04-18 14:30:00'
INTERVAL
Represents a duration that can be added to or subtracted from dates and timestamps.
order_date + INTERVAL '7 days'