Re: Slow update statement - Mailing list pgsql-performance

From Tom Lane
Subject Re: Slow update statement
Date
Msg-id 28597.1123514333@sss.pgh.pa.us
Whole thread Raw
In response to Re: Slow update statement  (Patrick Hatcher <pathat@comcast.net>)
List pgsql-performance
Patrick Hatcher <pathat@comcast.net> writes:
> Here's the table layout.  It's the first time I noticed this, but there
> is a PK on the cus_nbr and an index.  Does really need to be both and
> could this be causing the issue?  I thought that if a primary key was
> designated, it was automatically indexed.:

The duplicate index is certainly a waste, but it's no more expensive to
maintain than any other index would be; it doesn't seem likely that that
would account for any huge slowdown.

A long-shot theory occurs to me upon noticing that your join keys are
int8: 7.4 had a pretty bad hash function for int8, to wit it took the
low order half of the integer and ignored the high order half.  For
ordinary distributions of key values this made no difference, but I
recall seeing at least one real-world case where the information was
all in the high half of the key, and so the hash join degenerated to a
sequential search because all the entries went into the same hash
bucket.  Were you assigning cus_nbrs nonsequentially by any chance?

            regards, tom lane

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Finding bottleneck
Next
From: "Merlin Moncure"
Date:
Subject: Re: Finding bottleneck