Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy from stdin

Status
Not open for further replies.

feherke

Programmer
Aug 5, 2002
9,540
RO
Hi

While the COPY is faster then INSERT, I will use it. But for now I can only write it in a file, then run psql -f. Is any way to do this from a program ( in my case Kylix ), or is too PostgreSQL specific, to use it from outside ?

Or, is another possibility to add new records en-gros ( I have 15000 new records each time ) ?

Thanks,

Feherke.
 
Hi feherke,

Kylix is Borland's Linux version of turbo pascal. I have never used it, but I've heard good things about it. You should be able to perform the transfer between your postgres tables programically. There should be some way to pass command to the psql engine just as if you were sitting at a command window. In perl it seem it would be possible to pipe the output of the copy to command into the input of the copy from command, so the data really never hits a file.

I've never written a script or application to perform the copy command. I have use the copy command on the rare occasion when it is necessary to inport/export comma delimited files and the copy command has always worked great. Have you ever consider having everything go into one file from the start, with some flag that could be changed to indicate status?

LelandJ Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
> Kylix is Borland's Linux version of turbo pascal. I have never used it, but I've heard good things about it.

Certainly not from me. I have a lot of problems with Kylix. But this is another story.

> You should be able to perform the transfer between your postgres tables programically.

[tt]
Method - time
Individual INSERTs from program - 8 minutes
En-gros INSERTs from file - 20 seconds
En-gros COPY from file - 2 seconds
[/tt]

But the I do not like such external methods. Who knows what will be installed on the customer's machine, with what permissions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top