X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7FAEB9DC997 for ; Fri, 6 Jan 2006 10:04:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19015-03 for ; Fri, 6 Jan 2006 10:04:03 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 091E59DC88C for ; Fri, 6 Jan 2006 10:03:58 -0400 (AST) Received: from dd01.profihoster.net (dd01.profihoster.net [85.190.12.140]) by svr4.postgresql.org (Postfix) with ESMTP id C00795AF04B for ; Fri, 6 Jan 2006 14:03:59 +0000 (GMT) Received: from [192.168.54.10] (e180180114.adsl.alicedsl.de [85.180.180.114]) by dd01.profihoster.net (Postfix) with ESMTP id 8E9DF2381FF for ; Fri, 6 Jan 2006 15:00:33 +0100 (CET) Message-ID: <43BE78BE.3070508@laliluna.de> Date: Fri, 06 Jan 2006 15:03:42 +0100 From: Sebastian Hennebrueder User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: effizient query with jdbc References: <20051215080714.03919654@malmo.geotask.ch> In-Reply-To: <20051215080714.03919654@malmo.geotask.ch> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200601/38 X-Sequence-Number: 16516 You could issue one query containing a select uuid FROM MDM.KEYWORDS_INFO WHERE KEYWORDS_ID in (xy) where xy is a large comma separated list of your values. Best Regards / Viele Grüße Sebastian Hennebrueder ----- http://www.laliluna.de * Tutorials for JSP, JavaServer Faces, Struts, Hibernate and EJB * Seminars and Education at reasonable prices * Get professional support and consulting for these technologies Johannes Bühler schrieb: > Hi, > I have a java.util.List of values (10000) which i wanted to use for a > query in the where clause of an simple select statement. iterating > over the list and and use an prepared Statement is quite slow. Is > there a more efficient way to execute such a query. Thanks for any > help. Johannes > ..... > List ids = new ArrayList(); > > .... List is filled with 10000 values ... > > List uuids = new ArrayList(); > PreparedStatement pstat = db.prepareStatement("SELECT UUID FROM > MDM.KEYWORDS_INFO WHERE KEYWORDS_ID = ?"); for (Iterator iter = > ids.iterator(); iter.hasNext();) { String id = (String) iter.next(); > pstat.setString(1, id); > rs = pstat.executeQuery(); > if (rs.next()) { > uuids.add(rs.getString(1)); > } > rs.close(); > } > ... > > > >---------------------------(end of broadcast)--------------------------- >TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > > > >