X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E21B329E5F for ; Sat, 18 Sep 2004 22:29:12 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39860-03 for ; Sat, 18 Sep 2004 21:29:05 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id B47E1329E68 for ; Sat, 18 Sep 2004 22:29:06 +0100 (BST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1C8mlW-0000Gw-00 for ; Sun, 19 Sep 2004 09:29:06 +1200 Message-ID: <414CA8A0.7070707@opencloud.com> Date: Sun, 19 Sep 2004 09:29:04 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc Subject: raising the default prepareTheshold Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/108 X-Sequence-Number: 10998 I'd like to raise the default prepareThreshold to some non-zero value, perhaps 5 or so. This means that PreparedStatements that are used more than 5 times will allocate and use a named backend statement. Usually, using a named statement is a performance win as it avoids reparsing and replanning the query on each execution; I've seen measurable improvement (at least 15%, from memory) on heavily-reused simple queries where the parse/plan cost is a noticable fraction of total execution time. However, with a 8.0 backend, if the planner benefits from knowing the particular parameter values in use for a particular query, then using an unnamed statement may be faster due to using an improved plan. Under 7.4 there will be no difference; both named and unnamed statements will use the generic plan. So using named statements always by default (default prepareThreshold = 1) probably isn't a good idea. Using a default prepareThreshold > 1 seems like a reasonable compromise. What does everyone think? -O