Re: Performance decrease - Mailing list pgsql-performance

From Tom Lane
Subject Re: Performance decrease
Date
Msg-id 18973.1145547701@sss.pgh.pa.us
Whole thread Raw
In response to Performance decrease  ("Radovan Antloga" <radovan.antloga@siol.net>)
List pgsql-performance
"Radovan Antloga" <radovan.antloga@siol.net> writes:
> My test table has 15830 records with 190 fields.

190 fields in a table seems like rather a lot ... is that actually
representative of your intended applications?

> I do like this:

> update table
> set field = null

Again, is that representative of something you'll be doing a lot in
practice?  Most apps don't often update every row of a table, in my
experience.

> After first execute I get time 3 seconds. Then I repeat
> this update. After each update time increase. I get
> 4 sec, 7 sec, 10 sec, 12 sec, 15 sec, 18 sec, 21 sec.

There should be some increase because of the addition of dead rows,
but both the original 3 seconds and the rate of increase seem awfully
high for such a small table.  What are you running this on?

For comparison purposes, here's what I see on a full-table UPDATE
of a 10000-row table on a rather slow HP box:

regression=# \timing
Timing is on.
regression=# create table t1 as select * from tenk1;
SELECT
Time: 1274.213 ms
regression=# update t1 set unique2 = null;
UPDATE 10000
Time: 565.664 ms
regression=# update t1 set unique2 = null;
UPDATE 10000
Time: 589.839 ms
regression=# update t1 set unique2 = null;
UPDATE 10000
Time: 593.735 ms
regression=# update t1 set unique2 = null;
UPDATE 10000
Time: 615.575 ms
regression=# update t1 set unique2 = null;
UPDATE 10000
Time: 755.456 ms
regression=#

Vacuuming brings the time back down:

regression=# vacuum t1;
VACUUM
Time: 242.406 ms
regression=# update t1 set unique2 = null;
UPDATE 10000
Time: 458.028 ms
regression=#

            regards, tom lane

pgsql-performance by date:

Previous
From: "Radovan Antloga"
Date:
Subject: Performance decrease
Next
From: "Merlin Moncure"
Date:
Subject: Re: Takes too long to fetch the data from database