X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5291A52A24 for ; Fri, 29 Jul 2005 12:42:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70138-08 for ; Fri, 29 Jul 2005 15:42:27 +0000 (GMT) Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id E9041529E9 for ; Fri, 29 Jul 2005 12:42:26 -0300 (ADT) Received: from [192.168.1.110] (unknown [192.168.1.110]) by mail.ecircle.de (READY) with ESMTP id 3B37011CA3B; Fri, 29 Jul 2005 17:42:24 +0200 (CEST) Subject: Re: Select where id in (LARGE LIST) ? From: Csaba Nagy To: Jasper Potts Cc: Postgres JDBC In-Reply-To: <42EA4B90.4050606@jasperpotts.com> References: <42EA4B90.4050606@jasperpotts.com> Content-Type: text/plain Message-Id: <1122651744.2837.196.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 29 Jul 2005 17:42:24 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/418 X-Sequence-Number: 13566 Jasper, You can chunk your operation. That means to only use 100 entries in one run, and repeat it until all ids were processed. Use a prepared statement, that will save you some overhead. The last chunk will have less entries than the parameter placeholders, so you will have to build a special last statement, or to set the superfluous parameters to null or to one of the values from the last chunk, depends on what kind of query you have. We do all our data import/export this way, and it works fine. Cheers, Csaba. On Fri, 2005-07-29 at 17:30, Jasper Potts wrote: > I am working on a gui application which has a list of ids of selected > items. To perform an operation on the selected items I do a > "select/update .. where id in(...)". There seems to be a limit of > 100-200 items in the list. Is there a way of doing this with large > lists, maybe 10,000, 100,000 long? > > The best solution I have so far is to create a selection table and write > the select out to that and perform a join but the 100,000 inserts are slow. > > The ids are int8(long), so not talking large amounts of data, couple Mb > at most. Database and client running on same machine over localhost. > > Many Thanks > > Jasper > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match