Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 64E82475B2B; Tue, 11 Jun 2002 05:02:22 -0400 (EDT) Received: from taru.tm.ee (unknown [213.180.2.168]) by postgresql.org (Postfix) with ESMTP id 25B51475AF9; Tue, 11 Jun 2002 05:02:21 -0400 (EDT) Received: (from hannu@localhost) by taru.tm.ee (8.11.6/8.11.6) id g5BA2nu07245; Tue, 11 Jun 2002 12:02:49 +0200 X-Authentication-Warning: taru.tm.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: [HACKERS] Efficient DELETE Strategies From: Hannu Krosing To: Bruce Momjian Cc: Tom Lane , Christoph Haller , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org In-Reply-To: <200206110253.g5B2r0g14419@candle.pha.pa.us> References: <200206110253.g5B2r0g14419@candle.pha.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.3.99 Date: 11 Jun 2002 12:02:49 +0200 Message-Id: <1023789769.6942.44.camel@taru.tm.ee> Mime-Version: 1.0 X-Archive-Number: 200206/135 X-Sequence-Number: 8100 On Tue, 2002-06-11 at 04:53, Bruce Momjian wrote: > Tom Lane wrote: > > Bruce Momjian writes: > > > Hannu Krosing wrote: > > >> What about > > >> > > >> DELETE relation_expr FROM relation_expr [ , table_ref [ , ... ] ] > > >> [ WHERE bool_expr ] > > >> > > >> or > > >> > > >> DELETE relation_expr.* FROM relation_expr [ , table_ref [ , ... ] ] > > >> [ WHERE bool_expr ] > > > > > So make the initial FROM optional and allow the later FROM to be a list > > > of relations? Seems kind of strange. I was inspired by MS Access syntax that has optional relation_expr.* : DELETE [relation_expr.*] FROM relation_expr WHERE criteria it does not allow any other tablerefs in from > Clearly this is a TODO item. I will document it when we decide on a > direction. Or then we can just stick with standard syntax and teach people to do DELETE FROM t1 where t1.id1 in (select id2 from t2 where t2.id2 = t1.id1) and perhaps even teach our optimizer to add the t2.id2 = t1.id1 part itself to make it fast AFAIK this should be exactly the same as the proposed DELETE FROM t1 FROM t2 WHERE t2.id2 = t1.id1 -------------- Hannu