From jkanter@virginia.edu Wed Mar 20 19:15:05 2002 Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by postgresql.org (Postfix) with SMTP id AECF74758A1 for ; Wed, 20 Mar 2002 14:15:05 -0500 (EST) Received: from smtp.mail.virginia.edu by mail.virginia.edu id aa01598; 20 Mar 2002 14:15 EST Received: from jlk3xpc (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.9.3/8.9.3) with SMTP id OAA28012 for ; Wed, 20 Mar 2002 14:15:03 -0500 Message-ID: <008301c1d044$0b8fede0$de138f80@virginia.edu> From: Jodi Kanter To: Postgres Admin List Subject: slow inserts Date: Wed, 20 Mar 2002 14:18:41 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0080_01C1D01A.22921290" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200203/270 X-Sequence-Number: 3804 This is a multi-part message in MIME format. ------=_NextPart_000_0080_01C1D01A.22921290 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am currently using a Perl data loader that was set up to load data to thr= ee particular tables. The majority of this data is entered into one table. = The scripts obtain the data by parsing it out of an Excel spreadsheet. My l= oads seem to take a very long time. Each file only has about 12,000 rows, y= et it takes close to 25 minutes to load one file. I have placed some debugg= ing syntax in the code and it seems that the extra time if related to postg= res as I had originally thought it may have to do with the parsing of the E= xcel file. I have tried turning off FSYNC but there is no difference in load time. I a= lso tried removing the indexes from the table in which most of the data is = loaded but no luck. By the way, is there anyway to confirm that the FSYNC o= ption was turned off correctly? a way to view status or something? Any thoughts on what might be going on? another performance tuning trick th= at I have not thought of? Thanks for your help, Jodi Kanter _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu =20 =20 =20 ------=_NextPart_000_0080_01C1D01A.22921290 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am currently using a Perl data loader that was set up to load data t= o=20 three particular tables. The majority of this data is entered into one tabl= e.=20 The scripts obtain the data by parsing it out of an Excel spreads= heet.=20 My loads seem to take a very long time. Each file only has about 12,000 row= s,=20 yet it takes close to 25 minutes to load one file. I have placed some= =20 debugging syntax in the code and it seems that the extra time if related to= =20 postgres as I had originally thought it may have to do with the parsing of = the=20 Excel file.
 
I have tried turning off FSYNC but there is no difference in load time= . I=20 also tried removing the indexes from the table in which most of the data is= =20 loaded but no luck. By the way, is there anyway to confirm that the FSYNC o= ption=20 was turned off correctly? a way to view status or something?
 
Any thoughts on what might be going on? another performance tuning tri= ck=20 that I have not thought of?
 
Thanks for your help,
Jodi Kanter
 

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu

 

 

 

<= /DIV> ------=_NextPart_000_0080_01C1D01A.22921290-- From pdarley@kinesis-cem.com Wed Mar 20 19:31:34 2002 Received: from files.kinesis-cem.com (unknown [65.101.136.90]) by postgresql.org (Postfix) with ESMTP id 18CA0474E49 for ; Wed, 20 Mar 2002 14:31:34 -0500 (EST) Received: from pdarley (pdarley [192.168.1.12] (may be forged)) (authenticated bits=0) by files.kinesis-cem.com (8.12.2/8.12.2) with ESMTP id g2KJIbl8032643; Wed, 20 Mar 2002 11:18:37 -0800 From: "Peter Darley" To: "Jodi Kanter" , "Postgres Admin List" Subject: Re: slow inserts Date: Wed, 20 Mar 2002 11:31:29 -0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0017_01C1D002.C75912A0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-reply-to: <008301c1d044$0b8fede0$de138f80@virginia.edu> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200203/271 X-Sequence-Number: 3805 This is a multi-part message in MIME format. ------=_NextPart_000_0017_01C1D002.C75912A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Jodi, I believe DBI defaults to autocommitting queries, which slows it down. If you aren't specifically turning off the autocommit, I'd suggest it, which would make all the inserts go in one transaction which makes it much faster. You'd do something like: DBI->connect("dbi:Pg:dbname=dbname;host=hostname", 'user', 'password', {AutoCommit => 0}) Thanks, Peter Darley -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi Kanter Sent: Wednesday, March 20, 2002 11:19 AM To: Postgres Admin List Subject: [ADMIN] slow inserts I am currently using a Perl data loader that was set up to load data to three particular tables. The majority of this data is entered into one table. The scripts obtain the data by parsing it out of an Excel spreadsheet. My loads seem to take a very long time. Each file only has about 12,000 rows, yet it takes close to 25 minutes to load one file. I have placed some debugging syntax in the code and it seems that the extra time if related to postgres as I had originally thought it may have to do with the parsing of the Excel file. I have tried turning off FSYNC but there is no difference in load time. I also tried removing the indexes from the table in which most of the data is loaded but no luck. By the way, is there anyway to confirm that the FSYNC option was turned off correctly? a way to view status or something? Any thoughts on what might be going on? another performance tuning trick that I have not thought of? Thanks for your help, Jodi Kanter _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu ------=_NextPart_000_0017_01C1D002.C75912A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Jodi,
    I believe DBI defaults to autocommitting queries, = which=20 slows it down.  If you aren't specifically turning off the autocommit,= I'd=20 suggest it, which would make all the inserts go in one transaction which ma= kes=20 it much faster.  You'd do something like:
    DBI->connect("dbi:Pg:dbname=3Ddbname;host=3D= hostname",=20 'user', 'password', {AutoCommit =3D> 0})
Thanks,
Peter Darley
-----Original Message-----
From:=20 pgsql-admin-owner@postgresql.org=20 [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi=20 Kanter
Sent: Wednesday, March 20, 2002 11:19 AM
To:= =20 Postgres Admin List
Subject: [ADMIN] slow=20 inserts

I am currently using a Perl data loader that was set up to load data= to=20 three particular tables. The majority of this data is entered into one ta= ble.=20 The scripts obtain the data by parsing it out of an Excel=20 spreadsheet. My loads seem to take a very long time. Each file only has a= bout=20 12,000 rows, yet it takes close to 25 minutes to load one file. I ha= ve=20 placed some debugging syntax in the code and it seems that the extra time= if=20 related to postgres as I had originally thought it may have to do with th= e=20 parsing of the Excel file.
 
I have tried turning off FSYNC but there is no difference in load ti= me. I=20 also tried removing the indexes from the table in which most of the data = is=20 loaded but no luck. By the way, is there anyway to confirm that the FSYNC= =20 option was turned off correctly? a way to view status or something?
 
Any thoughts on what might be going on? another performance tuning t= rick=20 that I have not thought of?
 
Thanks for your help,
Jodi Kanter
 

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu
<= SPAN=20 style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt;= mso-fareast-font-family: 'MS Mincho'">

 

 

 

------=_NextPart_000_0017_01C1D002.C75912A0-- From nickf@ontko.com Wed Mar 20 19:46:42 2002 Received: from swan.prod.itd.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by postgresql.org (Postfix) with ESMTP id 3A41F475B58 for ; Wed, 20 Mar 2002 14:46:42 -0500 (EST) Received: from 1cust96.tnt1.richmond.in.da.uu.net ([63.27.103.96] helo=nick) by swan.prod.itd.earthlink.net with smtp (Exim 3.33 #1) id 16nm2e-00005Q-00; Wed, 20 Mar 2002 11:46:38 -0800 Reply-To: From: "Nick Fankhauser" To: "Jodi Kanter" , "Postgres Admin List" Subject: Re: slow inserts Date: Wed, 20 Mar 2002 14:42:03 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 In-Reply-To: <008301c1d044$0b8fede0$de138f80@virginia.edu> Importance: Normal X-Archive-Number: 200203/273 X-Sequence-Number: 3807 Jodi- Have you tried turning autocommit off & doing a single commit after the load? -NickF -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi Kanter Sent: Wednesday, March 20, 2002 2:19 PM To: Postgres Admin List Subject: [ADMIN] slow inserts I am currently using a Perl data loader that was set up to load data to three particular tables. The majority of this data is entered into one table. The scripts obtain the data by parsing it out of an Excel spreadsheet. My loads seem to take a very long time. Each file only has about 12,000 rows, yet it takes close to 25 minutes to load one file. I have placed some debugging syntax in the code and it seems that the extra time if related to postgres as I had originally thought it may have to do with the parsing of the Excel file. I have tried turning off FSYNC but there is no difference in load time. I also tried removing the indexes from the table in which most of the data is loaded but no luck. By the way, is there anyway to confirm that the FSYNC option was turned off correctly? a way to view status or something? Any thoughts on what might be going on? another performance tuning trick that I have not thought of? Thanks for your help, Jodi Kanter _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu From jkanter@virginia.edu Wed Mar 20 20:01:08 2002 Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by postgresql.org (Postfix) with SMTP id 32760475988 for ; Wed, 20 Mar 2002 15:01:08 -0500 (EST) Received: from smtp.mail.virginia.edu by mail.virginia.edu id aa10653; 20 Mar 2002 15:01 EST Received: from jlk3xpc (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.9.3/8.9.3) with SMTP id PAA16860 for ; Wed, 20 Mar 2002 15:01:07 -0500 Message-ID: <009d01c1d04a$7ac4a6f0$de138f80@virginia.edu> From: Jodi Kanter To: Postgres Admin List References: Subject: Re: slow inserts Date: Wed, 20 Mar 2002 15:04:44 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200203/274 X-Sequence-Number: 3808 None of the data is actually committed to the database until the scripts complete so I believe that autocommit is turned off. ----- Original Message ----- From: "Nick Fankhauser" To: "Jodi Kanter" ; "Postgres Admin List" Sent: Wednesday, March 20, 2002 2:42 PM Subject: Re: [ADMIN] slow inserts > Jodi- > > Have you tried turning autocommit off & doing a single commit after the > load? > > -NickF > > -----Original Message----- > From: pgsql-admin-owner@postgresql.org > [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi Kanter > Sent: Wednesday, March 20, 2002 2:19 PM > To: Postgres Admin List > Subject: [ADMIN] slow inserts > > > I am currently using a Perl data loader that was set up to load data to > three particular tables. The majority of this data is entered into one > table. The scripts obtain the data by parsing it out of an Excel > spreadsheet. My loads seem to take a very long time. Each file only has > about 12,000 rows, yet it takes close to 25 minutes to load one file. I have > placed some debugging syntax in the code and it seems that the extra time if > related to postgres as I had originally thought it may have to do with the > parsing of the Excel file. > > I have tried turning off FSYNC but there is no difference in load time. I > also tried removing the indexes from the table in which most of the data is > loaded but no luck. By the way, is there anyway to confirm that the FSYNC > option was turned off correctly? a way to view status or something? > > Any thoughts on what might be going on? another performance tuning trick > that I have not thought of? > > Thanks for your help, > Jodi Kanter > > _______________________________ > Jodi L Kanter > BioInformatics Database Administrator > University of Virginia > (434) 924-2846 > jkanter@virginia.edu > > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From rolf.luettecke@michael-telecom.de Thu Mar 21 07:50:40 2002 Received: from mail.michael-telecom.de (mabo-leuchten.de [195.243.212.246]) by postgresql.org (Postfix) with ESMTP id 409E5474E42 for ; Thu, 21 Mar 2002 02:50:40 -0500 (EST) Received: from dcm18 (dcm18.michael-telecom.de [192.168.0.130]) by mail.michael-telecom.de (TurboMail 2.7r2 on FreeBSD 4.5) with SMTP id B64A915BE3 for ; Thu, 21 Mar 2002 08:50:38 +0100 (CET) Date: Thu, 21 Mar 2002 09:56:01 +0100 From: Rolf Luettecke To: pgsql-admin@postgresql.org Subject: Re: slow inserts Message-Id: <20020321095601.7c3eff8b.rolf.luettecke@michael-telecom.de> In-Reply-To: <009d01c1d04a$7ac4a6f0$de138f80@virginia.edu> References: <009d01c1d04a$7ac4a6f0$de138f80@virginia.edu> Organization: MICHAELTELECOM AG X-Mailer: Sylpheed version 0.7.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200203/276 X-Sequence-Number: 3810 Hi Jodi, > None of the data is actually committed to the database until the scripts > complete so I believe that autocommit is turned off. > what if you try to write the output of your script into a separate file and pipe it to a psql as input? What i mean is to strip of the processing time for the "excel-part". Still 25 minutes to do the job? We often insert data in the same amount (10.000 - 100.000 rows per job) within a few seconds/minutes. A few months ago I had the same problem "writing" a dbf-file from postgres-data: The select-statement took milliseconds, but the conversion into db-format seems to be endless. BTW: We also had a table (10.000s of rows / daily vacuumed) which was rather slow during inserts (PostgreSQL 7.1.2). After upgrading to version 7.1.3 and completely rebuild the tables, the problem went away. Hope it helps R. Luettecke -- MICHAEL TELECOM AG Bruchheide 34 - 49163 Bohmte Fon: +49 5471 806-0 rolf.luettecke@michael-telecom.de http://www.michael-telecom.de From Morten.Sickel@nrpa.no Mon Mar 25 09:23:42 2002 Received: from postix.nrpa.no (unknown [193.217.14.3]) by postgresql.org (Postfix) with ESMTP id 6EB2547589D for ; Mon, 25 Mar 2002 04:23:42 -0500 (EST) Message-ID: <54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no> From: Morten Sickel To: 'Jodi Kanter' , Postgres Admin List Subject: Re: slow inserts Date: Mon, 25 Mar 2002 10:23:10 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200203/298 X-Sequence-Number: 3832 Jodi Kanter wrote: > I am currently using a Perl data loader that was set up to load data to three particular > tables. (Snip) > I have placed some debugging syntax in the code and it seems that the extra time if > related to postgres as I had originally thought it may have to do with the parsing of > the Excel file. You don't mention it, but I assume you are using DBI/pg. You are sure you are setting up you insert qyery handlers once and then reuse them? >s setting up a query handler takes a lot of time. ie my $dbh=DBI->connect(dbi:Pg ...); my $insh = $dbh->prepare("Insert into table values (?,?,?)"; foreach ($excelrow){ parse; $insh->execute($data1,$data2,$data3); } I have written a few script of that kind my self, and I was really surprised how much it mattered when I managed to move a $dbi->prepare out of the insert loop. regards -- Morten Sickel Norwegian Radiation Protection Authority From ferdinand@telegraafnet.nl Mon Mar 25 10:06:24 2002 Received: from server0.telegraafnet.nl (firewall.telegraafnet.nl [195.64.78.58]) by postgresql.org (Postfix) with ESMTP id 9110E475B86 for ; Mon, 25 Mar 2002 05:06:24 -0500 (EST) Received: from server9.telegraafnet.nl (server9.telegraafnet.nl [192.168.1.9]) by server0.telegraafnet.nl (8.9.3/8.9.3) with ESMTP id LAA14932; Mon, 25 Mar 2002 11:06:16 +0100 Received: from there (c22601.ws.tem.nl [192.168.1.26]) by server9.telegraafnet.nl (8.11.1/8.11.1/Debian 8.11.0-6) with SMTP id g2PA6IV27531; Mon, 25 Mar 2002 11:06:18 +0100 Message-Id: <200203251006.g2PA6IV27531@server9.telegraafnet.nl> X-Authentication-Warning: server9.telegraafnet.nl: Host c22601.ws.tem.nl [192.168.1.26] claimed to be there Content-Type: text/plain; charset="iso-8859-1" From: Ferdinand Smit To: Morten Sickel , "'Jodi Kanter'" , Postgres Admin List Subject: Re: slow inserts Date: Mon, 25 Mar 2002 11:06:15 +0100 X-Mailer: KMail [version 1.3.2] References: <54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no> In-Reply-To: <54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archive-Number: 200203/300 X-Sequence-Number: 3834 > my $dbh=DBI->connect(dbi:Pg ...); > > my $insh = $dbh->prepare("Insert into table values (?,?,?)"; > $insh->begin_work; > foreach ($excelrow){ > parse; > $insh->execute($data1,$data2,$data3); > } $insh->commit; > > I have written a few script of that kind my self, and I was really > surprised how much it mattered when I managed to move a $dbi->prepare out > of the insert loop. Try to use transactions, that increates the speed too. Regards, Ferdinand