A performance wrinkle 

use DBI;

my $attr = {
    AutoCommit        => 0,
    RaiseError        => 1,
    pg_enable_utf8    => 1,
    pg_server_prepare => 0,
};

my $dbh = DBI->connect($dsn, $user, undef, $attr);