Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BAAAB63293A for ; Sun, 3 May 2009 20:29:08 -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 14452-10 for ; Sun, 3 May 2009 20:29:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 6C682632202 for ; Sun, 3 May 2009 20:29:06 -0300 (ADT) Received: from 219-89-243-186.adsl.xtra.co.nz ([219.89.243.186] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1M0l6k-0001Hq-Pd; Mon, 04 May 2009 11:28:30 +1200 Message-ID: <49FE2897.3020802@opencloud.com> Date: Mon, 04 May 2009 11:28:23 +1200 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: John Lister CC: Dave Cramer , =?ISO-8859-1?Q?P=E9ter_Kov=E1cs?= , =?ISO-8859-1?Q?Fr=E9d=E9rik_Bilhaut?= , pgsql-jdbc@postgresql.org Subject: Re: Very strange performance decrease when reusing a PreparedStatement References: <5C2E1645-73B6-4509-96CD-FA77869516AB@noopsis.fr> <49F71EDD.2070200@opencloud.com> <02437794-A78D-449C-843F-B823195F9623@noopsis.fr> <491f66a50905030310j5b4cdcd8jbf4f6e757c2ba580@mail.gmail.com> <49FD72A2.3050408@kickstone.com> In-Reply-To: <49FD72A2.3050408@kickstone.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 200905/26 X-Sequence-Number: 19576 John Lister wrote: > However it seems that other optimisations can't be made for example it > doesn't seem possible to tell the server that parameter 1 is always > going to be an int and therefore it should be using index A. The current > implementation may not use index A as it is unaware as to the type of > the supplied parameter. Perhaps in this case the execution planner > should pick the parameters for the most optimal plan and return the > types during the parse and let the driver convert the data to what the > server requires... No it's not a problem with types at all, parameter types are fixed at the point the named statement is created. It's all about index selectivity statistics. -O