Re: effizient query with jdbc

From: Sebastian Hennebrueder <usenet(at)laliluna(dot)de>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: effizient query with jdbc
Date: 2006-01-06 14:03:42
Message-ID: 43BE78BE.3070508@laliluna.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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
>
>
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jaime Casanova 2006-01-06 15:26:43 Re: Improving Inner Join Performance
Previous Message Ian Westmacott 2006-01-06 14:00:06 Re: improving write performance for logging