$ time perl ./generate_words.pl > words.txt; real 7m54.686s $ time ( < words.txt psql -d test -c " drop table if exists words; create table words (word text, id serial); copy words(word) from stdin csv; " ) real 1m16.223s