Lists: | pgsql-general |
---|
From: | "Waller, David" <Waller_D(at)IMSDM(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Insert statements really slow |
Date: | 2007-11-09 17:53:08 |
Message-ID: | DEC16B2C3347C64BAC476767D0B36229038AC4F7@JACO.sccompanies.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
I have an application that I am porting from MySQL to PostgreSQL and I
am working on the import Perl script that process the data.
The data is web log data and each line has a variable amount of the
fields (mostly because of cookies) so I am using a lot of insert
statements.
In MySQL I go through a file in about 2 minutes and it is taking about
30 in PG. I have removed all but the primary key index and have done a
BEGIN and COMMIT after turning off AUTOCOMMIT.
What other things should I be looking at to spped this up?
Dave Waller
From: | Andrew Sullivan <ajs(at)crankycanuck(dot)ca> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Insert statements really slow |
Date: | 2007-11-09 18:01:33 |
Message-ID: | 20071109180133.GY24585@crankycanuck.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Fri, Nov 09, 2007 at 11:53:08AM -0600, Waller, David wrote:
> The data is web log data and each line has a variable amount of the
> fields (mostly because of cookies) so I am using a lot of insert
> statements.
>
> In MySQL I go through a file in about 2 minutes and it is taking about
> 30 in PG. I have removed all but the primary key index and have done a
> BEGIN and COMMIT after turning off AUTOCOMMIT.
>
> What other things should I be looking at to spped this up?
It could be that your server is doing too much work because you don't have
enough WAL segments or something.
But I'd suggest looking at COPY for bulk imports. It's way faster.
A
--
Andrew Sullivan
Old sigs will return after re-constitution of blue smoke
From: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | "Waller, David" <Waller_D(at)imsdm(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Insert statements really slow |
Date: | 2007-11-09 19:18:18 |
Message-ID: | dcc563d10711091118s4069d221k5e9fca51ef814c1d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Nov 9, 2007 11:53 AM, Waller, David <Waller_D(at)imsdm(dot)com> wrote:
>
> In MySQL I go through a file in about 2 minutes and it is taking about 30 in
> PG. I have removed all but the primary key index and have done a BEGIN and
> COMMIT after turning off AUTOCOMMIT.
How many rows are you wrapping in begin/commit pairs? Hopefully a
good number, but just wondering.
From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Waller, David" <Waller_D(at)imsdm(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Insert statements really slow |
Date: | 2007-11-14 02:44:07 |
Message-ID: | b42b73150711131844g209da3a9u6ed38241b4ce54ba@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Nov 9, 2007 12:53 PM, Waller, David <Waller_D(at)imsdm(dot)com> wrote:
> I have an application that I am porting from MySQL to PostgreSQL and I am
> working on the import Perl script that process the data.
>
> The data is web log data and each line has a variable amount of the fields
> (mostly because of cookies) so I am using a lot of insert statements.
>
> In MySQL I go through a file in about 2 minutes and it is taking about 30 in
> PG. I have removed all but the primary key index and have done a BEGIN and
> COMMIT after turning off AUTOCOMMIT.
can you give us a better idea of the # records/sec we are talking
about here? mysql and pg are usually pretty close in insert
performance. maybe there is something fishy going on.
merlin
From: | "Waller, David" <Waller_D(at)IMSDM(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Cc: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
Subject: | Re: Insert statements really slow |
Date: | 2007-11-14 14:05:57 |
Message-ID: | DEC16B2C3347C64BAC476767D0B36229038ACDAB@JACO.sccompanies.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
I have found some errors in my perl script that was slowing everything
down. I too am now seeing similar speed between postgresql and mysql.
Sorry for the confusion.
Dave
-----Original Message-----
From: Merlin Moncure [mailto:mmoncure(at)gmail(dot)com]
Sent: Tuesday, November 13, 2007 8:44 PM
To: Waller, David
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Insert statements really slow
On Nov 9, 2007 12:53 PM, Waller, David <Waller_D(at)imsdm(dot)com> wrote:
> I have an application that I am porting from MySQL to PostgreSQL and I
> am working on the import Perl script that process the data.
>
> The data is web log data and each line has a variable amount of the
> fields (mostly because of cookies) so I am using a lot of insert
statements.
>
> In MySQL I go through a file in about 2 minutes and it is taking about
> 30 in PG. I have removed all but the primary key index and have done
> a BEGIN and COMMIT after turning off AUTOCOMMIT.
can you give us a better idea of the # records/sec we are talking about
here? mysql and pg are usually pretty close in insert performance.
maybe there is something fishy going on.
merlin