X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7509ED7D51 for ; Mon, 19 Sep 2005 20:08:37 -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 40666-09 for ; Mon, 19 Sep 2005 23:08:31 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 75604D71EA for ; Mon, 19 Sep 2005 20:08:32 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 98CB4355BB; Mon, 19 Sep 2005 16:07:44 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 974A6355B8; Mon, 19 Sep 2005 16:07:44 -0700 (PDT) Date: Mon, 19 Sep 2005 16:07:44 -0700 (PDT) From: Stephan Szabo To: Martin Nickel Cc: pgsql-performance@postgresql.org Subject: Re: How can this be? In-Reply-To: Message-ID: <20050919160622.F99507@megazone.bigpanda.com> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/206 X-Sequence-Number: 14514 On Fri, 16 Sep 2005, Martin Nickel wrote: > Hello all, > Mostly Postgres makes sense to me. But now and then it does something > that boggles my brain. Take the statements below. I have a table > (agent) with 5300 rows. The primary key is agent_id. I can do SELECT > agent_id FROM agent and it returns all PK values in less than half a > second (dual Opteron box, 4G ram, SATA Raid 10 drive system). > > But when I do a DELETE on two rows with an IN statement, using the primary > key index (as stated by EXPLAIN) it take almost 4 minutes. > pg_stat_activity shows nine other connections, all idle. Are there any tables that reference agent or other triggers? My first guess would be that there's a foreign key check for something else that's referencing agent.agent_id for which an index scan isn't being used.