Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id BDAFD2E0D10 for ; Tue, 29 Jan 2008 14:16:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 88036-08 for ; Tue, 29 Jan 2008 14:15:54 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 1D0222E2D3D for ; Tue, 29 Jan 2008 14:08:51 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m0TI8o2e023232; Tue, 29 Jan 2008 13:08:50 -0500 (EST) To: mlunnon@rwa-net.co.uk cc: mclister@zeesource.net, pgsql-performance@postgresql.org Subject: Re: JDBC/Stored procedure performance issue In-reply-to: <479EFC21.60606@rwa-net.co.uk> References: <018573B2-DC52-4B98-9AB6-1ACB953B0035@zeesource.net> <6915.1201553513@sss.pgh.pa.us> <479EFC21.60606@rwa-net.co.uk> Comments: In-reply-to Matthew Lunnon message dated "Tue, 29 Jan 2008 10:12:49 +0000" Date: Tue, 29 Jan 2008 13:08:50 -0500 Message-ID: <23231.1201630130@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/296 X-Sequence-Number: 28535 Matthew Lunnon writes: > Is there any way to work out what plan the query is using in side the > function? I think I have a similar problem with a query taking much > longer from inside a function than it does as a select statement. Standard approach is to PREPARE a statement that has parameters in the same places where the function uses variables/parameters, and then use EXPLAIN [ANALYZE] EXECUTE to test it. regards, tom lane