"Adam Palmblad" <adam@xxxxxxxxxxxx> writes: > We've got a C function that we use here and we find that for every > connection, the first run of the function is much slower than any > subsequent runs. ( 50ms compared to 8ms) Perhaps that represents the time needed to load the dynamic library into the backend? If so, the "preload_libraries" parameter might help you fix it. Or consider pooling connections. Or build a custom executable with the function linked in permanently. regards, tom lane