dump a perl array into a psql DB via 'copy'; help?

Yanni Chiu yanni-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Wed Dec 15 15:21:41 UTC 2004


Madison Kelly wrote:
> ... This way I would
> avoid a second disk IO hit by avoiding the need to have 'psql' read the
> file.

If you can process the files serially, or if you have enough memory,
you could write your files to an in-memory tmp partition (I've forgotten
the correct term for it), to avoid a disk write. I just looked at
manpages for swapon, mount, fstab, but could not find what I'm thinking
of, so I hope its not just a SunOS/Solaris thing.

>    My question is how can I get the same function as 'psql dbname -f
> data.txt' except telling 'psql' to get the values from the array instead?

My Perl is rusty, but wouldn't piping into the psql stdin work, i.e.:

    open(PSQL, "| psql $dbname")

HTH.
--yanni

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list