X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 67FD19FA159 for ; Wed, 10 May 2006 00:52:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 28942-04 for ; Wed, 10 May 2006 00:52:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id B01E99F9DCD for ; Wed, 10 May 2006 00:52:10 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k4A3q9g7025877; Tue, 9 May 2006 23:52:09 -0400 (EDT) To: "Adam Palmblad" cc: pgsql-performance@postgresql.org Subject: Re: Slow C Function In-reply-to: <6B5AF6293A289F45826220B17ABE79370D5F4C@BORON.aers.local> References: <6B5AF6293A289F45826220B17ABE79370D5F4C@BORON.aers.local> Comments: In-reply-to "Adam Palmblad" message dated "Tue, 09 May 2006 14:57:09 -0700" Date: Tue, 09 May 2006 23:52:09 -0400 Message-ID: <25876.1147233129@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/220 X-Sequence-Number: 19007 "Adam Palmblad" 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