pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Johannes Bühler <jbuehler@geotask.ch>
Subject: effizient query with jdbc
Date: Thu, 15 Dec 2005 08:07:14 +0100
Message-ID: <20051215080714.03919654@malmo.geotask.ch> (raw)

 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();
 } 
 ... 
 




view thread (7+ messages)  latest in thread

Message-ID: <20051215080714.03919654@malmo.geotask.ch>
Permalink:  ../20051215080714.03919654@malmo.geotask.ch/
Also on:    postgresql.org/message-id/20051215080714.03919654@malmo.geotask.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: jbuehler@geotask.ch
  Subject: Re: effizient query with jdbc
  In-Reply-To: <20051215080714.03919654@malmo.geotask.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox