The original pipeline was correct but slow: row-by-row Python, synchronous database calls, and redundant validation passes. Correctness was never the issue; throughput was.
The biggest wins came from batching database operations with SQLAlchemy bulk inserts, pushing validation into set-based SQL where possible, and introducing Python concurrency and async for I/O-bound steps. Profiling before optimizing mattered: two hot loops accounted for most of the runtime.
Schema and indexing changes helped on the PostgreSQL side: composite indexes on the keys used in joins, and staging tables that let validation run as a single pass instead of per-record checks.
The lesson generalizes: ETL speed is usually a systems problem, not an algorithm problem. Understand where time goes, fix the top offenders, and add data-quality gates so speed never trades off against correctness.
Parallelism has limits. Python threads help I/O; multiprocessing helps CPU-bound transforms; blindly parallelizing database writes can deadlock or thrash connection pools. Profile, then parallelize the right stage.
Document the pipeline as stages with expected row counts. When stage four suddenly outputs half the rows, you want an alert, not a surprised analyst on deadline.
Idempotent stages make reruns safe. Survey ETL gets re-run when methodology changes; design steps so "run again" does not duplicate or corrupt.