change _write_postgres to use psycopg2 copy_from for speed improvements