in reply to How to make my DBD::CSV DB code faster.

You can also use DBD::AnyData instead of DBD::CSV and take advantage of DBD::AnyData's in-memory tables:
use DBI; #my $dbh = DBI->connect("DBI:CSV:f_dir=.;csv_eol=\n;") or die "Cannot +connect: " . $DBI::errstr; #$dbh->{'csv_tables'}->{'bt'} = { 'file' => './X_Con.csv'}; #$dbh->{'csv_tables'}->{'sec'} = { 'file' => './Y_Con.csv'}; #$dbh->{'csv_tables'}->{'stats'} = { 'file' => './Z_Con.csv'}; my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):'); $dbh->func( 'bt', 'CSV', './X_Con.csv', 'ad_import'); $dbh->func( 'sec', 'CSV', './Y_Con.csv', 'ad_import'); $dbh->func( 'stats', 'CSV', './Z_Con.csv', 'ad_import');
And rest off your code should work unchanged, and will be much faster because it's reading from RAM instead of disk.
note (see the docs) that any changes to those tables have to be explicitly written to disk if you want them saved.

For even better performance (though the above will probably be sufficient for you), see graff's hash-it-up solution.

Replies are listed 'Best First'.
Re^2: How to make my DBD::CSV DB code faster.
by jZed (Prior) on Sep 30, 2005 at 02:39 UTC
    The in-memory tables are now a feature of all SQL::Statement DBDs, so with DBD::CSV you can CREATE TEMP TABLE foo ... to create an in-memory table, you don't need to switch to DBD::AnyData for that.