Re: effizient query with jdbc

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: effizient query with jdbc
Дата
Msg-id 1380B56B-1419-4F4D-894B-979F075F18CF@fastcrypt.com
обсуждение исходный текст
Ответ на effizient query with jdbc  (johannesbuehler@oderbruecke.de)
Ответы Re: effizient query with jdbc  (Steve Peterson <stevep-hv@zpfe.com>)
Список pgsql-performance
The problem is you are getting the entire list back at once.

You may want to try using a cursor.

Dave
On 15-Dec-05, at 9:44 AM, johannesbuehler@oderbruecke.de wrote:

> 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 6: explain analyze is your friend
>


В списке pgsql-performance по дате отправления:

Предыдущее
От: Carlos Benkendorf
Дата:
Сообщение: Re: ORDER BY costs
Следующее
От: Steve Peterson
Дата:
Сообщение: Re: effizient query with jdbc