Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B2A922E01AF for ; Sat, 23 Feb 2008 12:26:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 47184-03 for ; Sat, 23 Feb 2008 12:26:04 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id 845172E011E for ; Sat, 23 Feb 2008 12:26:02 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d37so1551305pye.29 for ; Sat, 23 Feb 2008 08:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; bh=rlbGBMtz2AXadUzwpolfjNqZBEF/yII7pxfxlMvVi8s=; b=KO9XB26meeqoJnau/0Zl1frqMYOljsUoHXj5e2KZGFuDYH2DypcVFLXuZ4BWGcd+J6JG57bwuDRjkJVz25c1vGywGSSaDvCJejlEv/qx3lJ6tV6TvJUijfMF4/6S/dJeiNoRUbDOuwiQkW5FoECZdYhlaBg4eBWI0lV/CEh+EMo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=fe5OC8fhT5ZFhlZQRtCzqZErZsMwpDNI/0DqnUXp5jJhSds81XXcrQMqEN/2JrpbpZvpjSWsX9K6YsRTmP2RQKRttR9/HetAsH1cLhC8D344HdRYT6xqEwP1R4Y8N06ZDX2gqjRaR+o4yvnUGmuK+NKkeLyQxuLQJaXsIVbzIkc= Received: by 10.35.12.10 with SMTP id p10mr697232pyi.36.1203783961983; Sat, 23 Feb 2008 08:26:01 -0800 (PST) Received: from albook.local ( [69.207.169.30]) by mx.google.com with ESMTPS id p57sm3006227pyb.15.2008.02.23.08.25.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 23 Feb 2008 08:26:00 -0800 (PST) Message-ID: <47C04916.2070500@gmail.com> Date: Sat, 23 Feb 2008 11:25:58 -0500 From: Paul Tomblin User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Does "preparing" a PreparedStatement really help? Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: 200802/184 X-Sequence-Number: 18391 Is there a performance advantage for preparing a PreparedStatement and keeping it around and using it thousands of times rather than making a new Statement every time? How big? Back when I was doing Oracle Call Interface programming in C back in the mid to late 1980s, we were always told that pre-parsing a query was very expensive and so you tried not to do it very often, and once you'd done it, you stored them to reuse. As I try to switch this system over to using a connection pool, trying to store PreparedStatements for each connection is fairly complicated and I'm wondering if it's worth it. -- Paul Tomblin http://blog.xcski.com/ I wouldn't be surprised if I'd have to put garlic in the CD drawer to really get rid of it. -- Arthur van der Harg on 'Gator'