postgresqlubuntuamazon-ec2ogr2ogr

ogr2ogr slow upload to postgres


I need to upload geojson to a PostgreSQL database, using ogr2ogr. When I upload the geojson on the same server that the PostgreSQL database is on, ogr2ogr uploads a file in around 3-4 seconds. When I run ogr2ogr on my Ubuntu 16.04 computer, though, ogr2ogr takes ages, up to 1+ hour for the same file. I have a an i72600k on my desktop while the server is an Amazon EC2 free trial micro instance, so it can't be processing power. One thing I did notice is opening system monitor on my desktop shows a 7KB/sec upload speed system wide, so I'm not sure if it's just uploading incredibly slow on my desktop. I use the same host URL for the ogr2ogr command on both machines, so it's not like the Amazon ec2 instance is saving a DNS lookup. What can be wrong?


Solution

  • I solve it by using --config PG_USE_COPY YES.