Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id F07B61A726B6 for ; Wed, 25 Jul 2012 23:14:12 -0300 (ADT) Received: from mail-yw0-f46.google.com ([209.85.213.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SuDab-0006PN-T2 for pgsql-performance@postgresql.org; Thu, 26 Jul 2012 02:14:12 +0000 Received: by yhmm54 with SMTP id m54so1454322yhm.19 for ; Wed, 25 Jul 2012 19:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=4eyQAhOZzKYxv4CXS1XyRTKG5D9oIaxlSIE43hvxpiA=; b=ZvQnt57R7GVdwlnLeRP6OXevuZTitBzFbMHG/DqanCC7V01p2SDNtDMkeaum+aznYN V/Bj/ydCtg0OZ+r0w+0YTyCufBdFmT1/myxiGKnS4Ex69yQvufKl3KLUAIiZ3IUkUJm1 unFeIP8r40wrzbZwDC45r5geMehDn0TvEZ8B5SEVEcCV4xeh16qyJpAb0mBKAhq3/mkW 8o56Xv+cmJz6pVboRoYKFtV3BrNLJaz+lL9w5++pfRKAW0e1qqzMIui2BbWPcQyBYdt8 4evrZBqlaHSQWZ6Oy3z4cuF7ybpsY59RC8p5NQo1OI+w2nlhdfsdNRZ5Vxr3XLslQ66h V2hg== Received: by 10.66.79.40 with SMTP id g8mr16863701pax.27.1343268835690; Wed, 25 Jul 2012 19:13:55 -0700 (PDT) Received: from [192.168.1.5] ([116.226.34.12]) by mx.google.com with ESMTPS id ku7sm15490807pbc.31.2012.07.25.19.13.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 19:13:54 -0700 (PDT) Message-ID: <5010A7DC.5000202@gmail.com> Date: Thu, 26 Jul 2012 10:13:48 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Geoserver-PostGIS performance problems References: <500E690D020000DB000A78CC@pta-emo.csir.co.za> <4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com> <500E7478020000DB000A78E9@pta-emo.csir.co.za> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201207/337 X-Sequence-Number: 47518 Why not just use simple Statement instead of PreparedStatement and construct the SQL with concated string or StringBuilder? like this: int col1=xxx; String col2="xxxx"; String sql="select * from table where col1="+col+" and col2='"+col2+"'"; 于 2012/7/26 3:59, Vinicius Abrahao 写道: > On Wed, Jul 25, 2012 at 4:26 PM, Merlin Moncure wrote: >> On Wed, Jul 25, 2012 at 2:17 PM, Vinicius Abrahao wrote: >>> On Wed, Jul 25, 2012 at 3:45 PM, Merlin Moncure wrote: >>>>> Note that it seems the preparing/planning interaction was not the >>>>> poster's actual problem, but it may have been yours. As Tom Lane notes >>>>> in that thread, this should get better in 9.2. >>>> jdbc should get some blame too -- it's really aggressive about >>>> preparing queries. >>>> >>> indeed! >>> Is there any reason for that? >> IMNSHO it's an oversight in the core JDBC design dating back to the >> beginning: you have two basic choices for executing SQL. The >> unparameterized Statement or the parameterized PreparedStatement. >> There should have been a 'ParamaterizedStatement' that gave the >> expectation of paramaterization without setting up and permanent >> server side structures to handle the query; libpq makes this >> distinction and it works very well. Of course, there are various ways >> to work around this but the point stands. >> > That is true, I was observing the same, days ago: > > Running queries and statments in jdbc: > https://github.com/vinnix/JavaLab/blob/master/Scrollable.java > > And running queries with libpq: > https://github.com/vinnix/testLibPQ/blob/master/testlibpq.c > > Is this possible to change something (I really don't know what or > where) in the jdbc driver > to get more direct aproach? (if that's make any sense to you guys...) > > Best regards, > > vinnix >