Re: [SQL] Efficient DELETE Strategies - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: [SQL] Efficient DELETE Strategies
Date
Msg-id 1023789769.6942.44.camel@taru.tm.ee
Whole thread Raw
In response to Re: [SQL] Efficient DELETE Strategies  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Tue, 2002-06-11 at 04:53, Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> 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



pgsql-hackers by date:

Previous
From: Fduch the Pravking
Date:
Subject: Re: Timestamp/Interval proposals: Part 2
Next
From: Karel Zak
Date:
Subject: Re: Timestamp/Interval proposals: Part 2