X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8D5EB9DC84D for ; Sun, 12 Feb 2006 21:30:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77167-05 for ; Sun, 12 Feb 2006 21:30:13 -0400 (AST) X-Greylist: delayed 00:24:41.268652 by SQLgrey- Received: from pillette.com (adsl-67-119-5-202.dsl.snfc21.pacbell.net [67.119.5.202]) by postgresql.org (Postfix) with ESMTP id ED93A9DCA75 for ; Sun, 12 Feb 2006 21:30:07 -0400 (AST) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id k1D15R726930; Sun, 12 Feb 2006 17:05:27 -0800 Date: Sun, 12 Feb 2006 17:05:27 -0800 From: andrew@pillette.com Message-Id: <200602130105.k1D15R726930@pillette.com> Subject: Re: SQL Function Performance To: "Adnan DURSUN" Cc: X-Originating-IP: 67.124.229.87 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.395 required=5 tests=[AWL=-0.155, NO_REAL_NAME=0.55] X-Spam-Score: 0.395 X-Spam-Level: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200602/138 X-Sequence-Number: 17124 If you have only recently analyzed the tables in the query, close your psql session (if that's what you were using) and then restart it. I've gotten burned by asking a query using the function, which I believe is when PG creates the plan for the function, and then making significant changes to the tables behind it (new index, bulk insert, etc.). By starting a new session, the function will be re-planned according to up to date statistics or using newly created indices.