Answer the question
In order to leave comments, you need to log in
PostgreSQL using COPY on remote DB?
Good afternoon, I encountered such a phenomenon as using COPY in postgres. I uploaded and updated large prices ~ 5 million. The problem arises in the fact that in production the database will be transferred to another server.
In PHP scripts, I use COPY , but this command does not work if the database is not on localhost.
What can you advise in this case, how to be?
PS, there are such thoughts:
1) you can make sure that the database is local
2) you can use exec psql -c -h ...., but in this case it will not work to make a transaction
3) you can look towards master -> slave replication
Answer the question
In order to leave comments, you need to log in
What is stopping you from executing your php script with COPY on a remote server via ssh connection? You can also run a psql command over the same connection. At the end of a transaction with COPY, you can save the success flag of this transaction in some database table and check it from the main server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question