Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6F1EE37BFB4 for ; Thu, 2 Oct 2008 09:14:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 85179-02 for ; Thu, 2 Oct 2008 09:14:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A5E6537C013 for ; Thu, 2 Oct 2008 09:14:24 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m92CEK8p023316; Thu, 2 Oct 2008 08:14:20 -0400 (EDT) To: "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" cc: pgsql-performance@postgresql.org Subject: Re: Delete performance again In-reply-to: <331e40660810020242u2f0f5de2qe146312e448a7df4@mail.gmail.com> References: <331e40660810020242u2f0f5de2qe146312e448a7df4@mail.gmail.com> Comments: In-reply-to "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" message dated "Thu, 02 Oct 2008 12:42:15 +0300" Date: Thu, 02 Oct 2008 08:14:20 -0400 Message-ID: <23315.1222949660@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/17 X-Sequence-Number: 31598 "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" writes: > delete from company where id not in (select company_id from company_descr); > I've tried to analyze command, but unlike to other RDBM I've used it did not > include cascade deletes/checks into query plan. That is first problem. > It was SLOW. Usually the reason for that is having forgotten to make an index on the referencing column(s) ? regards, tom lane