in reply to Re^2: Select DB data into CSV file
in thread Select DB data into CSV file
This is fine until your table outgrows your memory: selectall_arrayref will read all rows into memory and then pass it to csv (), whereas using a fetch handle has virtually no memory overhead.
my $sth = $dbh->prepare ("select * from foo"); $sth->execute; csv (out => "foo.csv", in => sub { $sth->fetch }, undef_str => "\\N");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Select DB data into CSV file
by 1nickt (Canon) on Dec 20, 2018 at 13:24 UTC |