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 B35BB9DC9E3 for ; Thu, 15 Dec 2005 03:44:40 -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 31520-02 for ; Thu, 15 Dec 2005 03:44:41 -0400 (AST) X-Greylist: delayed 00:29:57.687204 by SQLgrey- Received: from smtp.tiscali.ch (smtp.tiscali.ch [212.40.5.52]) by postgresql.org (Postfix) with ESMTP id DCACB9DC9F4 for ; Thu, 15 Dec 2005 03:44:37 -0400 (AST) Received: from malmo.geotask.ch (adsl-145-217-fixip.tiscali.ch [212.254.145.217]) by smtp.tiscali.ch (8.11.7/8.11.7) with ESMTP id jBF7Edp20351 for ; Thu, 15 Dec 2005 08:14:39 +0100 Date: Thu, 15 Dec 2005 08:07:14 +0100 From: Johannes =?ISO-8859-1?B?QvxobGVy?= Subject: effizient query with jdbc Message-ID: <20051215080714.03919654@malmo.geotask.ch> Organization: GeoTask AG X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i686-suse-linux) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: undisclosed-recipients:; X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.883 required=5 tests=[UNDISC_RECIPS=0.883] X-Spam-Score: 0.883 X-Spam-Level: X-Archive-Number: 200512/519 X-Sequence-Number: 16340 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(); } ...