I've experienced this with both Postgres 7.4.3 and 7.4.5, using Perl
modules DBD::Pg 1.40 and DBI 1.48.
To boil it down to the simplest case:
I can run a few instances of the following program in parallel, but if I
try to run 12 in parallel the database system will lock up, so that I
can't run a psql either.
In our production system we get similar behavior.
Program follows:
**********************************
use strict;
use subs;
use integer;
use XML::Simple;
use Data::Dumper;
use Exporter;
use Proc::ProcessTable;
use POSIX;
my $db = "dbi:Pg:dbname=issp";
my $dbh = DBI->connect($db, "postgres", "p0stgr3s");
sub do_query($;$) {
my $query = shift;
my $dbh = shift;
my $own_dbh = 0;
if (! $dbh) {
my $db = "dbi:Pg:dbname=testdb";
$dbh = DBI->connect($db, "", "");
$own_dbh = 1;
}
if ($dbh) {
my $res = $dbh->do($query);
$dbh->disconnect() if $own_dbh;
defined($res) or die "DATABASE: " . $DBI::errstr . " " . $query;
return $res;
} else {
die "DATABASE: " . $DBI::errstr;
}
}
foreach (1..500) {
print STDERR "$_ ";
my $item = sprintf("l%05d", $_);
my $res = do_query("UPDATE config_vals SET config_val='$item'
WHERE ".
"config_key='ID_CODE'", $dbh);
}
$dbh->disconnect();