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 782BFD70BF for ; Mon, 12 Sep 2005 02:06:54 -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 81129-08 for ; Mon, 12 Sep 2005 05:06:51 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id C2859D6FBB for ; Mon, 12 Sep 2005 02:06:51 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050912050651m9100ps21ke>; Mon, 12 Sep 2005 05:06:51 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id 38E2055FCC; Mon, 12 Sep 2005 00:06:51 -0500 (CDT) Received: from [209.101.126.19] (unknown [209.101.126.19]) by juju.arbash-meinel.com (Postfix) with ESMTP id 08DEA55FA7; Mon, 12 Sep 2005 00:06:43 -0500 (CDT) Message-ID: <43250CE1.6090602@arbash-meinel.com> Date: Mon, 12 Sep 2005 01:06:41 -0400 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Cc: arnaulist@andromeiberica.com, pgsql-performance@postgresql.org Subject: Re: Advise about how to delete entries References: <43183AC9.1060704@andromeiberica.com> <431C0F48.5050809@andromeiberica.com> <431D77F5.4070307@drule.org> In-Reply-To: <431D77F5.4070307@drule.org> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDD752B50F7A119A757208707" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 required=5 tests=[AWL=-0.013, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200509/135 X-Sequence-Number: 14443 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDD752B50F7A119A757208707 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Kevin wrote: > Arnau wrote: > >> Hi all, >> >> > >> > COPY FROM a file with all the ID's to delete, into a temporary >> table, and do a joined delete to your main table (thus, only one query). >> >> >> I already did this, but I don't have idea about how to do this join, >> could you give me a hint ;-) ? >> >> Thank you very much > > > maybe something like this: > > DELETE FROM statistics_sasme s > LEFT JOIN temp_table t ON (s.statistic_id = t.statistic_id) > WHERE t.statistic_id IS NOT NULL > Why can't you do: DELETE FROM statistics_sasme s JOIN temp_table t ON (s.statistic_id = t.statistic_id); Or possibly: DELETE FROM statistics_sasme s WHERE s.id IN (SELECT t.statistic_id FROM temp_table t); I'm not sure how delete exactly works with joins, but the IN form should be approximately correct. John =:-> --------------enigDD752B50F7A119A757208707 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDJQzhJdeBCYSNAAMRAlMQAJ9M4gp+3FwiIiWvqIi9dNfZnhGycgCaAtir BVTS7qLnC8m6Sk5OZOz+iag= =FfAs -----END PGP SIGNATURE----- --------------enigDD752B50F7A119A757208707--