Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk> writes:
> From what I udnerstand of the architecture it seems that the SPI API
> is inherently single threaded.
The entire backend is inherently single-threaded.
> If not, am I right? Can only one user supplied proc be running at once
> across the whole postgres engine?
What do you consider "the whole engine"? Each connection has its own
backend process. Also, SPI is recursive even though not thread-safe:
it's possible for an SPI-executed query to call a function that
performs another SPI query.
regards, tom lane