Re: [SQL] More efficient DELETE ... ?

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] More efficient DELETE ... ?
Date: 2000-01-22 23:18:03
Message-ID: Pine.BSF.4.21.0001221917340.79710-100000@thelab.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, 22 Jan 2000, Tom Lane wrote:

> The Hermit Hacker <scrappy(at)hub(dot)org> writes:
> > This looks painful ...
>
> > DELETE FROM webhit_referer_raw
> > WHERE oid IN ( SELECT w.oid
> > FROM webhit_referer_raw w, referrer_data r
> > WHERE stat_date < 'Jan 17 2000 15:05:00'
> > AND w.referrer_url = r.referrer );
>
> I believe you can do
>
> DELETE FROM webhit_referer_raw
> WHERE referrer_url = referrer_data.referrer
> AND referrer_data.stat_date < 'Jan 17 2000 15:05:00';
>
> (I assume stat_date is in referrer_data, otherwise this'd be easy.)

nope, stat_date is in webhit_referer_raw, but it works like a charm,
thanks :)

Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy(at)hub(dot)org secondary: scrappy(at){freebsd|postgresql}.org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2000-01-23 01:29:10 Re: [SQL] SQL Things
Previous Message Tom Lane 2000-01-22 21:43:40 Re: [SQL] More efficient DELETE ... ?