X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AB354D1D3BC for ; Thu, 11 Mar 2004 00:52:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48884-01 for ; Wed, 10 Mar 2004 20:52:25 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id C55A6D1D2E2 for ; Wed, 10 Mar 2004 20:52:21 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i2B0qK1c018800 for ; Thu, 11 Mar 2004 00:52:21 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i2B0fg4f017800 for pgsql-performance@postgresql.org; Thu, 11 Mar 2004 00:41:42 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: Re: optimizing large query with IN (...) Date: Wed, 10 Mar 2004 19:41:45 -0500 Organization: Hub.Org Networking Services Lines: 17 Message-ID: <404FB5C9.3060803@selectacast.net> References: <62371.200.174.148.100.1078889715.squirrel@webmail.webnow.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "Marcus Andree S. Magalhaes" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en In-Reply-To: <62371.200.174.148.100.1078889715.squirrel@webmail.webnow.com.br> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/176 X-Sequence-Number: 6032 Marcus Andree S. Magalhaes wrote: > Guys, > > I got a Java program to tune. It connects to a 7.4.1 postgresql server > running Linux using JDBC. > > The program needs to update a counter on a somewhat large number of > rows, about 1200 on a ~130k rows table. The query is something like > the following: > > UPDATE table SET table.par = table.par + 1 > WHERE table.key IN ('value1', 'value2', ... , 'value1200' ) > How often do you update this counter? Each update requires adding a new row to the table and invalidating the old one. Then the old ones stick around until the next vacuum.