X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 08E5A9DC86D for ; Fri, 10 Feb 2006 17:01:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06561-10 for ; Fri, 10 Feb 2006 17:01:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from outbound.internet-mail-service.net (outbound6.internet-mail-service.net [216.240.47.197]) by postgresql.org (Postfix) with ESMTP id E0C729DC826 for ; Fri, 10 Feb 2006 17:01:06 -0400 (AST) Received: from idiom.com (idiom.com [216.240.32.1]) by outbound.internet-mail-service.net (Postfix) with ESMTP id 02B8723F297 for ; Fri, 10 Feb 2006 13:01:08 -0800 (PST) Received: from [192.168.1.109] (adsl-69-107-112-198.dsl.pltn13.pacbell.net [69.107.112.198]) by idiom.com (8.12.11/8.12.11) with ESMTP id k1AL17Sf079499 for ; Fri, 10 Feb 2006 13:01:07 -0800 (PST) (envelope-from bryce1@obviously.com) Message-ID: <43ECFF0B.80905@obviously.com> Date: Fri, 10 Feb 2006 13:00:59 -0800 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050921 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Very slow updates when using IN syntax subselect Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200602/119 X-Sequence-Number: 24129 If I do: select event_id from event join token using (token_number) where token_status=50 and reconciled=false limit 1; Then: update event set reconciled=true where event_id={XXX}; It returns in about a second, or less. But If I do the same thing with the IN syntax: update event set reconciled=true where event_id in (select event_id from event join token using (token_number) where token_status=50 and reconciled=false LIMIT 1); On a 4 CPU machine, 2 CPU's peg at 100%, and the request just eats CPU forever. Any clues what might be going on? Help would be much appreciated. I'm not seeing this on all my DB's... just the important ones. PostgreSQL 7.4.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20)