running a query file of 42MB

From: "Nefnifi, Kasem" <Kasem(dot)Nefnifi(at)atosorigin(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: running a query file of 42MB
Date: 2004-12-28 13:27:54
Message-ID: 25D4919915CCF742A88EE3366D6D913D0867292E@mailserver1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I'm trying to run query generated by an import script. postgresql 8
onder windows XP.
the file is about 42MB, i've opened this file by pgAdminIII and start
the query, it inserts data into 3 tables and after makes some update.
the time is too much and it hangs up without any commit.

any body know another methode to run the query.

i've tried with the command line psql, but get errors because the file
is like:

insert into table1 (pkey) values ('xxx');
insert into table2 (pkey,field) values ('yyy',(select OID from table1
where pkey='xxx'));
update table1 set field1='a', field2='b', field3='c' where pkey = 'xxx';

insert into table1 (pkey) values ('xxx');
insert into table2 (pkey,field) values ('zzz',(select OID from table1
where pkey='xxx'));
update table1 set field1='u', field2='v', field3='q' where pkey = 'xxx';
.
.
.etc

the reason to do so is to get the OID for each record inserted into the
table1 and use that in the table2.
i've limited the query to 2 tables but there are more tables and also
more related fields from the same table.

in the psql i've tried this:
>psql -d dbname -u username -f file.sql
i've also tried with
>psql -d dbname -u username < file.sql

but get the error, pkey violatde. should i use a commit between each
record ?

regards,
kasem,
****************************************************************************
Disclaimer:
This electronic transmission and any files attached to it are strictly
confidential and intended solely for the addressee. If you are not
the intended addressee, you must not disclose, copy or take any
action in reliance of this transmission. If you have received this
transmission in error, please notify the sender by return and delete
the transmission. Although the sender endeavors to maintain a
computer virus free network, the sender does not warrant that this
transmission is virus-free and will not be liable for any damages
resulting from any virus transmitted.
Thank You.
****************************************************************************

Browse pgsql-general by date

  From Date Subject
Next Message Nefnifi, Kasem 2004-12-28 14:44:56 Re: running a query file of 42MB
Previous Message Peter Childs 2004-12-28 13:06:33 Re: 8.0 rc2 Problem