X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id F27E4CC61D for ; Wed, 16 Jul 2003 20:49:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 73792-10 for ; Wed, 16 Jul 2003 20:49:54 +0000 (GMT) Received: from mxrelay.ptc.com (poster.ptc.com [12.11.148.30]) by svr1.postgresql.org (Postfix) with ESMTP id 53B3DCC616 for ; Wed, 16 Jul 2003 17:49:28 -0300 (ADT) Received: from HQ-EXFE4.ptcnet.ptc.com (localhost [127.0.0.1]) by mxrelay.ptc.com (8.9.0/8.9.0) with ESMTP id QAA29425; Wed, 16 Jul 2003 16:49:51 -0400 (EDT) Received: from hq-mail1.ptcnet.ptc.com ([132.253.201.69]) by HQ-EXFE4.ptcnet.ptc.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 16 Jul 2003 16:49:50 -0400 Received: from ptc.com ([132.253.96.61]) by hq-mail1.ptcnet.ptc.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 16 Jul 2003 16:49:49 -0400 Message-ID: <3F15BA6D.7070106@ptc.com> Date: Wed, 16 Jul 2003 16:49:49 -0400 From: Erik Price User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Julien Le Goff Cc: pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements References: <200307161624.39340.julien.legoff@laposte.net> In-Reply-To: <200307161624.39340.julien.legoff@laposte.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Jul 2003 20:49:49.0850 (UTC) FILETIME=[CC9147A0:01C34BDB] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/64 X-Sequence-Number: 7448 Julien Le Goff wrote: > Hello everyone, > > I have a question regarding the efficiency of Prepared Statements. I'm > working on a project, and my task now is to decide whether it's worth > it to use PS. This problem came up when, beginning to implement jdbc > classes, we noticed that we would need a lot of PS - something like 40 > per class. Each PS would be a class variable, and it sounds weird to > have 40 class variables... We could have a more elegant system using > normal statements, but would it be much less efficient? My understanding is that the efficiency of a PreparedStatement really depends on the database. I have no information about this subject in reference to PostgreSQL (or any other database), however. Usually you will want to use a PreparedStatement so that in the case where a database -does- make use of it and caches the query, it will be done. However, you've mentioned that you have an equally performant and more elegant solution using regular queries. I'd go with elegance until you really need the performance. Erik