Re: [QUESTIONS] Postgres still dying on insert - Mailing list pgsql-hackers
| From | Robert Hiltibidal |
|---|---|
| Subject | Re: [QUESTIONS] Postgres still dying on insert |
| Date | |
| Msg-id | 3.0.3.32.19980428071553.00ac9100@springpatch.com Whole thread Raw |
| In response to | Re: [QUESTIONS] Postgres still dying on insert (Ralf Berger <Ralf.Berger@ipk.fhg.de>) |
| List | pgsql-hackers |
Howdy,
I just moved our existing customer database from 6.2.1 to 6.3.2. I couldn't
get the pg_dump command to work right so I made the following script.
The end result was I made over 8000 insertions in under an hour without a
failure. A random sampling of different areas shows the records made it
over intact.
I had problems with 6.3.1 but 6.3.2 seems to be ok.. My big wish list is
for access97 to seamlessly work with it....
-Rob
NOTE: This mess was a quick hack job with no commenting... took me about 5
minutes to make. IF only I could code C++ that fast... Anyway just type
datawarez.pl <filename>
where <filename> is the name of the table.
The file is generated from an earlier version of Postgres using \o
<filename> and then a select * from <filename>; at the command prompt.
This perl script does single line queries only. No Transactions.
-r
#! /usr/bin/perl
#
# PROGRAM: DATAWAREZ.PL DATE: 28-APR-98
# CREATOR: ROBERT HILTIBIDAL
#
# PURPOSE: DATAWAREZ,PL takes the data file from the command line and
# then outouts each line as a queruy to the database
# Get the filename
$file = $ARGV[0];
# Set the count variable
$count = 0;
# Start the mess
open(sql,"$file");
while (<sql>) {
if ($count == 0) {
@fields = split(/\|/,$_);
$fields[$#fields] =~ s/\n//g;
}
else {
@data = split(/\|/,$_);
$data[$#data] =~ s/\n//g;
$data[$#data] =~ s/\r//g;
$data[$#data] =~ s/\f//g;
}
$count++;
if ($count > 1) {
$query = "Insert into $file (";
$fieldcount =0;
foreach $element (@fields) {
if ($fieldcount == $#fields) {
$query .= "$element)";
}
else {
$query .= "$element,";
}
$fieldcount++;
}
$query .= " VALUES (";
$datcount = 0;
foreach $element (@data) {
if ($datcount == $#data) {
$query .= "\'$element\');";
}
else {
$query .= "\'$element\',";
}
$datcount++;
}
print "$query \n\n";
@results = `/usr/local/pgsql/bin/psql -t -A -q -d YOURDB -c "$query"`;
print @results,"\n\n";
}
}
close sql;
At 11:30 AM 4/28/98 +0200, Ralf Berger wrote:
>Hello,
>
>I've a very similiar problem with postgres 6.3.1.
>The postmaster dies with no comment on insertion on my Linux 2.0.33
>96MB box, when I whant to create a new user. (I've postet the problem
>with no response.)
>I've track it down to an insert to pg_user.
>
>Because of my lack of time I downgrate to 6.2.1, and all whent well.
>
>I assume the cause is in my limited disk-place (about 30MB on the
>disk where the database reside).
>
>I have not testet 6.3.2.
>
> Ralf
>
>--
>Fraunhofer IPK
>Dipl.-Inform. Ralf Berger
>Pascalstr. 8-9
>10587 Berlin
>
>Tel.: ++49-(0)30 390 06 129
>Fax.: ++49-(0)30 391 10 37
>
>---
>
>In anything at all, perfection is finally attained not when
>there is no longer anything to add, but when there is
>no longer anything to take away.
>
>Antoine de Saint Exupery
>--
>Official WWW Site: http://www.postgresql.org
>Online Docs & FAQ: http://www.postgresql.org/docs
>Searchable Lists: http://www.postgresql.org/mhonarc
>
>
##########################################################
Robert Hiltibidal Office 217-544-2775
Systems Programmer Fax 217-527-3550
FGInet, Inc
rob@fgi.net
morgan@springpatch.com
pgsql-hackers by date: