Link to home
Start Free TrialLog in
Avatar of kinton
kinton

asked on

Import PostgeSQL

I have been given a postgreSQL database export (txt file).  

It contains the create table structures, insert statements etc for the whole database.

Does anyone know of a tool that will import the file directly into an MSSQL database?    Importing it into a local postgress and then into SQL is painfully slow and I need to run this several times over the next few weeks.
Avatar of Martyn Spencer
Martyn Spencer
Flag of United Kingdom of Great Britain and Northern Ireland image

I am not aware of a tool that will do this for you directly. If I may suggest an approach though (at the risk of teaching Grandma to suck eggs)?

If the insert statements contain "standard" data rather than binary encoded data, you could use a tool such as sed to replace column definitions and to strip out or replace Postgresql specific SQL and then run the script as any other SQL server script. Much depends upon the complexity of the export.

The other question is how long is the import taking into your local Postgresql database and how long is the export taking. Perhaps it is the efficiency of the SQL generation that is causing the problem.

There are various migration tools available that will connect to the Postgresql database and directly migrate into SQL server. The best ones tend to be commercial, but they often have trials. Maybe this is a way of handling it?
Avatar of kinton
kinton

ASKER

Thanks for the input!   It's taking 3 days to import into the postgres database which is far too long.  I have found the tools you mention but don't have direct access to the postgres server sadly.
Probably you need a custom tool that will parse the text file (.sql ? ) ...lookup at the mappings between Postgre and MsSQL make the replacements and finally make the import to MSSQL.
How large is the import file? That sounds like it is a very large database.
Avatar of kinton

ASKER

500 mb, so not massive
I would suggest that with a file that size, there is an issue with your Postgresql configuration or the machine on which it is running. An import that size should not be taking that long IMO.
Avatar of kinton

ASKER

ok, thank you, might take another look at that
ASKER CERTIFIED SOLUTION
Avatar of kinton
kinton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial