punkish
punkish

Reputation: 15248

querying for data from two tables in different databases

Initially I thought this would be a stupid question, but now I am inspired by the following question.

Background: I have a lot of data in MySQL, but MySQL's spatial support is terrible. Ideally I would like to migrate everything to Postgres, but converting from MySQL to Postgres is a massive ball of hurt (I've already wasted close to a week struggling with it). Now I am thinking, if only I could maintain only the spatial portion in Pg, do the spatial queries in Pg, then use those row ids to query non-spatial data from MySQL.

I am a Perl DBI person. My question is thus -- can I create a single database handle that actually allows querying by JOINing a table from Pg with a table from MySQL, assuming they have a common id column?

Upvotes: 2

Views: 931

Answers (2)

Mingliang
Mingliang

Reputation: 79

No, I don't think you could do it that way. You would have to query the data separately and combine the results in your code. I believe there are no REAL RDB's that can do what you want.

Upvotes: 1

jmacinnes
jmacinnes

Reputation: 1609

No, you will need to query both separately and combine the data at the application layer. See a more informed answer here:

How to create linked server MySQL

Upvotes: 2

Related Questions