Re: :(( VEEERRRRYYYY SLLLOOOWWWWWW!

From: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
To: "Costin Manda" <costin(dot)m(at)interpoint(dot)ro>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: :(( VEEERRRRYYYY SLLLOOOWWWWWW!
Date: 2005-04-03 12:45:27
Message-ID: 000801c5384b$037180c0$5179f345@WATSON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


----- Original Message -----
From: "Costin Manda" <costin(dot)m(at)interpoint(dot)ro>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: Monday, March 28, 2005 7:27 AM
Subject: [NOVICE] :(( VEEERRRRYYYY SLLLOOOWWWWWW!

>I have this computer using postgres and PHP script that access and insert
> values in this database. I also have a computer with a MsSQL db on it. I
> made a script to read and update values from the MsSQL db to postgres.
>
> At the time I had postgres 7.4.1 and the script went excruciatingly slow.
> Something like 4 inserts per second! I tried every optimisation trick I
> could find on the net, but to no avail.
>
> Finally I upgraded to 8.0.1 and the script ran INSTANTLY! like, 200
> thousand
> inserts in 10 minutes. So I was very happy about it. But yesterday the
> power
> went off. When I restarted the computer, the script went very slow again.
>
> I tried vacuuming, reindexing, deleting all indexes and recreating them,
> using pg_resetxlog, changing linux kernel variables and postgres
> configuration variables. Nothing helps!

I'm not sure what this particular issue is (why the change in behavior), but
did you consider changing your code to use "copy" instead of "insert"? The
same 200k rows will probably copy in a few seconds. If you absolutely need
to do the insert, make sure you are "preparing" the SQL and then
"executing".

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Tucknott 2005-04-03 13:18:46 CREATE TYPE and %ROWTYPE
Previous Message Bruno Wolff III 2005-04-03 12:14:52 Re: [NOVICE] Function which gives back the