I've two identical (in structure) databases dwelling on separate after sales servers.

I have to develop some logic to 'merge' their data right into a single database on the third server.

My primary design would be to load their data (by table) into memory using a mix of Perl hashes and arrays and merging them there, then carrying out a single massive email a nearby DB (also identical in structure).

I'd repeat for those tables (4-5).

I have seen posts about merging tables, although not confident that I'm able to apply certain of individuals reactions as my tables live in separate databases (not to mention separate machines).

My real question is shall we be held tied to needing to load the outcomes into memory first or exist options that come with MySQL will be able to use to my advantage?

What "mu" stated needs addressing, but I am unsure I'd opt for this method whatsoever.

  1. Obtain the two databases to the target server using standard mysql dump/restore
  2. Use standard queries to merge them in to the third DB using standard queries

You need to let MySQL perform the heavy-lifting.