Re: Update using primary key slow - Mailing list pgsql-performance

From Tom Lane
Subject Re: Update using primary key slow
Date
Msg-id 23322.1130442063@sss.pgh.pa.us
Whole thread Raw
In response to Re: Update using primary key slow  (Denis <denis.sailer@yellowbook.com>)
Responses Re: Reasons and drawbacks for unused item pointers (was: Update using primary key slow)
List pgsql-performance
Denis <denis.sailer@yellowbook.com> writes:
> tgl@sss.pgh.pa.us (Tom Lane) wrote in
> news:19722.1130429883@sss.pgh.pa.us:
>> The 183 msec is the time needed to *fetch* the row, not the time to
>> update it.  So it could well be that the other time is just the time
>> needed to update the table and indexes.  If this seems slower than
>> your hardware ought to be able to handle, I'd wonder about how
>> recently the table has been vacuumed.

> Here is the latest vacuum today.

> INFO:  "contract": removed 64146 row versions in 26115 pages
> DETAIL:  CPU 1.94s/2.55u sec elapsed 7.78 sec.
> INFO:  "contract": found 64146 removable, 5106307 nonremovable row
> versions in 129154 pages
> DETAIL:  890 dead row versions cannot be removed yet.
> There were 1905028 unused item pointers.

The "unused item pointers" number seems a bit high, but otherwise that
looks pretty reasonable.

Is it possible that the particular row you were updating has been
updated quite a lot of times since the last vacuum?  Or even quite
a few times within a single transaction?  The only thing I can think
of that would explain such a slow fetch is if the code has to reject
a bunch of recently-dead versions of the row.

            regards, tom lane

pgsql-performance by date:

Previous
From: "PostgreSQL"
Date:
Subject: How much memory?
Next
From: "PostgreSQL"
Date:
Subject: Re: What gets cached?