COPY command with PHP
От | Robert Fitzpatrick |
---|---|
Тема | COPY command with PHP |
Дата | |
Msg-id | 1098546599.11072.15.camel@columbus.webtent.org обсуждение исходный текст |
Список | pgsql-general |
I have a PHP script that was having problems using the COPY command with files around 1500 lines in size. The script will build the copy data from incoming CSV file into a temp file, then start a COPY command and loop through the copy data using pg_put_line to insert and then pg_end_copy after posting the last line as '\.'. Worked well under that 1500 line area. What I found was if I issue a pg_connection_busy($dbh) before the pg_put_line(...) in the while statement processing the lines of the temp file handle, it works. Don't ask me why, that is what I'd like to know. If I report back if busy is true, I get nothing. Maybe it is just giving a millisecond to breathe or something while checking to see if the connection is busy? One thing though, don't know if it had anything to do with it, the script is on an old box with an AMD 300 processor with maybe 256MB memory while the database is on an up to date dual Pentium 4 processor with 1GB mem. Of course, if I took the copy data file it is trying to COPY into PostgreSQL and psql to bring it in on the server directly, no issues. Not that it doesn't work with the busy check, just curious as to what is causing the need for it since I spent many hours to finally find the answer. No one on the PHP list seemed to know. -- Robert
В списке pgsql-general по дате отправления: