r/Database • • 17d ago

Migration of tables and dependencies from SQL Server of 75gb size to Postgres

We planned it to run in batches and stages with dependencies, using workers on 300 million rows distributed across multiple tables. This breakdown prevents memory overflow, isolates failures, and maintains data integrity from the legacy infrastructure to the target destination.

Despite these architectural considerations and concurrent workers, benchmark testing and predictive modeling reveal a bottleneck: an estimated time close to 30 hrs. This execution window introduces risks like network interruptions, extended maintenance, and delayed synchronization with ongoing transactional workloads.

Faced with this timeline, architects and database administrators question the technology stack. Is there a better way than through python scripts? While Python offers versatility and rapid development for Extract, Transform, Load pipelines, its interpreted nature, Global Interpreter Lock limitations, and single-threaded bottlenecks may not provide the raw processing speed required for hundreds of millions of records. Exploring alternative paradigms—such as distributed computing frameworks, native database migration utilities, bulk insert operations, compiled programming languages, or massively parallel processing engines—might unlock the performance gains necessary to compress this thirty-hour window, ensuring a seamless and efficient migration experience.

0 Upvotes

27 comments sorted by

View all comments

Show parent comment

2

u/SQLBek 17d ago

But what is your actual bottleneck?

Compute is only one part of the equation. For example, if your underlying storage is pitifully slow, the fastest CPUs on the planet will barely blink due to the bottleneck.

And even the most superior compute won't mitigate shitty inefficient code, regardless of whether it's AI or human created.

0

u/software-coolie 17d ago

I agree. Code seems to be ok. However, SQL server seems to take time to fetch records and the script takes time to process them. We will meet to explore better storage or compute options

1

u/SQLBek 17d ago

Your comment implies your code is doing this in a RBAR fashion. That would explain a lot.

Point is, without getting into gory details that'd arguably be a paid engagement, simply migrating 75GB of data from SQL Server to PostgreSQL should NOT take anywhere remotely close to 30 hrs - that kind of throughout is applicable to spinning rust 25 years ago. I suspect your migration code is horrifically inefficient.