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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: The Hermit Hacker <scrappy(at)hub(dot)org>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] More efficient DELETE ... ?
Date: 2000-01-22 17:56:59
Message-ID: 200001221756.MAA22581@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> 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 );
>
> But, reading through the man page, it looks like this about the only way
> of doing it? Or am I missing something as obvious as the UPDATE I asked
> about the other day? :(

Read chapter 8 from my book. That is the only way for DELETE. You
could to EXISTS and that may be faster.

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Stosberg 2000-01-22 18:06:39 geo_distance radius question
Previous Message The Hermit Hacker 2000-01-22 17:20:06 More efficient DELETE ... ?