John Coers <coers(at)intrinsity(dot)com> writes:
> Ah so! So after each tuple is written to shared memory there is a giant
> scramble for the lock. Explains all the semops and timer sets and sleeps
> in the truss output that I've been seeing.
Hmm ... semops? What platform are you on, anyway, and which PG version?
It sounds like you might be running with the fallback SysV-semaphore-
based implementation of spinlocks, which is orders of magnitude more
horrid than even the normal test-and-set-based implementation. If there
is TAS support for your machine then I'd only expect to see select(2)
calls during spinlock operations. Does your version of src/include/os.h
define HAS_TEST_AND_SET?
regards, tom lane