Reputation: 4952
I have a MySQL database that I'd like to convert into a Postgres Database. I found that pgloader.io does this. How can I accomplish this task?
Upvotes: 1
Views: 1721
Reputation: 4952
LOAD DATABASE
FROM mysql://root:password@localhost/development
INTO postgresql://helson@localhost/development
WITH include drop, create tables, create indexes, reset sequences,
workers = 8, concurrency = 1,
multiple readers per thread, rows per range = 50000,
prefetch rows = 10000
SET PostgreSQL PARAMETERS
maintenance_work_mem to '128MB',
work_mem to '12MB',
search_path to 'sakila, public, "$user"'
SET MySQL PARAMETERS
net_read_timeout = '120',
net_write_timeout = '120'
;
There are other options to limit the tables, such as
including only table names matching 'users'
which you can include before the semicolon.
pgloader schema
where schema is the path of the file with the pgloader schema.
It's simple enough. Clone the repository and make with the following command
make DYNSIZE=20000 pgloader
This will create a new executable with a much larger heap size. You can execute the binary with
./build/bin/pgloader ~/schema
or wherever your schema is located.
NULL
instead of 0000-00-00 00:00:00
). Fix these issues and rerun pgloader, but this time only include the specific tables you need.And that should be it!
Upvotes: 1