Josh Berkus <josh@agliodbs.com> writes:
>> The main problem on INSERTs is that it is usually the same few pages:
>> the lead data block and the lead index block. There are ways of
>> spreading the load out across an index, but I'm not sure what happens on
>> the leading edge of the data relation, but I think it hits the same
>> block each time.
> I actually have several test cases for this, can you give me a trace or
> profile suggestion that would show if this is happening?
If it is a problem, the LockBuffer calls in RelationGetBufferForTuple
would be the places showing contention delays.
It could also be that the contention is for the WALInsertLock, ie, the
right to stuff a WAL record into the shared buffers. This effect would
be the same even if you were inserting into N separate tables.
regards, tom lane