Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 71C0B634E63 for ; Tue, 10 Mar 2009 05:06:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 59026-09 for ; Tue, 10 Mar 2009 05:05:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.mnc.ch (62-2-77-205.static.cablecom.ch [62.2.77.205]) by mail.postgresql.org (Postfix) with ESMTP id BA509634C78 for ; Tue, 10 Mar 2009 05:05:56 -0300 (ADT) Received: from localhost (mail2.mnc.ch [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 53B2C23079; Tue, 10 Mar 2009 08:05:51 +0000 (GMT) X-Virus-Scanned: amavisd-new at mnc.ch Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail2.mnc.ch [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id xMHXpxFuODNA; Tue, 10 Mar 2009 08:05:51 +0000 (GMT) Received: from meuh.localdomain (62-2-77-204.static.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 003DA23020; Tue, 10 Mar 2009 08:05:50 +0000 (GMT) Received: by meuh.localdomain (Postfix, from userid 1000) id 1ABDFDF23A; Tue, 10 Mar 2009 09:05:52 +0100 (CET) To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Subject: Re: [PERFORM] Query much slower when run from postgres function References: <49B51B60.6030600@megafon.hr> <27649.1236616294@sss.pgh.pa.us> <87fxhmmygj.fsf@meuh.mnc.lan> <1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.com> <5165.1236618994@sss.pgh.pa.us> <491f66a50903091256n7fe4a3f6i93267d0d53b983cb@mail.gmail.com> <49B58ABE.7070105@opencloud.com> From: Guillaume Cottenceau X-Hashcash: 1:20:090310:oliver@opencloud.com::ZkggUnb5tUxYGHyu:000000000000000000000000000000000000000009Ptr X-Hashcash: 1:20:090310:pgsql-jdbc@postgresql.org::6sfTxrGZ3NI5dbrB:0000000000000000000000000000000000000/ZC Date: Tue, 10 Mar 2009 09:05:52 +0100 In-Reply-To: <49B58ABE.7070105@opencloud.com> (Oliver Jowett's message of "Tue\, 10 Mar 2009 10\:31\:42 +1300") Message-ID: <87bps9ls4f.fsf@meuh.mnc.lan> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/49 X-Sequence-Number: 19379 Oliver Jowett writes: > The idea behind the threshold is that if a PreparedStatement object is > reused, that's a fairly good indication that the application wants to > run the same query many times with different parameters (since it's > going to the trouble of preserving the statement object for reuse). But Or it may just need the safeness of driver/database parameter "interpolation", to get a "free" efficient safeguard against SQL injection. As for myself, I have found no other way to obtain driver/database parameter interpolation. So sometimes I use prepared statements even for running a query only once. I am unsure it is a widely used pattern, but SQL injection being quite important to fight against, I think I may not be the only one. -- Guillaume Cottenceau