Adrian Moisey <adrian@careerjunction.co.za> writes:
>> we've found it: TRUNCATE
> I haven't been following this thread. Can someone please explain to me
> why TRUNCATE causes these spikes?
It's not so much the TRUNCATE as the overhead of broadcasting the
resultant catalog changes to the many hundreds of (mostly idle)
backends he's got --- all of which respond by trying to lock the
shared sinval message queue at about the same time.
You could see the whole thread as an object lesson in why connection
pooling is a good idea. But certainly it seems that sinval is the
next bottleneck in terms of being able to scale Postgres up to very
large numbers of backends.
regards, tom lane