Thread: Re: [HACKERS] strange behavior of UPDATE

Re: [HACKERS] strange behavior of UPDATE

From
ZEUGSWETTER Andreas IZ5
Date:
> - update bench set k500k = k500k + 1 where k100 = 30
>     with    indeces  unknown
>    without indeces 36 seconds

can you run an: explain update bench set k500k = k500k + 1 where k100 = 30;

> Still the poor update routines do not explain the
> strange behavior, that the postmaster runs for
> hours using at most 10% CPU, and all the time
> heavy disk activity is observed.

I suspect it is doing a seq scan. Thus explaining the heavy disk activity.
I have previously sent in a patch which will fix this if someone applies it.

Andreas



Re: [HACKERS] strange behavior of UPDATE

From
Tom Lane
Date:
ZEUGSWETTER Andreas IZ5 <Andreas.Zeugswetter@telecom.at> writes:
> can you run an: explain update bench set k500k = k500k + 1 where k100 = 30;
> I suspect it is doing a seq scan.

No, that's not it:

test=> explain update bench set k500k = k500k + 1 where k100 = 30;
NOTICE:  QUERY PLAN:

Index Scan using k100 on bench  (cost=179.05 rows=2082 width=154)


The benchmark loads the tables first and then builds indexes, and
in fact does a vacuum analyze after that!  So the stats should be fine.
        regards, tom lane