Thread: DELETE FROM A BLACK LIST

DELETE FROM A BLACK LIST

From
luca.scaramella@recom.it
Date:
Hi all,
I have a Blacklist table containing about 1000 ID to delete from another
table (T1 about 1440294 records)
If i use the SQL

DELETE FROM T1 WHERE T1.ID IN (SELECT BLACKLIST.ID FROM BLACKLIST)

the operation is very slow .

There is a faster way to do the same operation??

Thanks
Luca







Re: DELETE FROM A BLACK LIST

From
Achilleus Mantzios
Date:
On Wed, 5 Mar 2003 luca.scaramella@recom.it wrote:

> 
> Hi all,
> I have a Blacklist table containing about 1000 ID to delete from another
> table (T1 about 1440294 records)
> If i use the SQL
> 
> DELETE FROM T1 WHERE T1.ID IN (SELECT BLACKLIST.ID FROM BLACKLIST)
> 
> the operation is very slow .
> 
> There is a faster way to do the same operation??
use EXISTS
> 
> Thanks
> Luca
> 
> 
> 
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-210-8981112
fax:    +30-210-8981877
email:  achill@matrix.gatewaynet.com       mantzios@softlab.ece.ntua.gr



Re: DELETE FROM A BLACK LIST

From
Christoph Haller
Date:
>
> I have a Blacklist table containing about 1000 ID to delete from
another
> table (T1 about 1440294 records)
> If i use the SQL
>
> DELETE FROM T1 WHERE T1.ID IN (SELECT BLACKLIST.ID FROM BLACKLIST)
>
> the operation is very slow .
>
> There is a faster way to do the same operation??
>
Try
DELETE FROM T1 WHERE T1.ID = BLACKLIST.ID
It really works.

Regards, Christoph





Re: DELETE FROM A BLACK LIST

From
"Chad Thompson"
Date:
You could use where exists.

delete from t1 where exists (select id from blacklist as b where b.id =
t1.id)

HTH
Chad
----- Original Message -----
From: <luca.scaramella@recom.it>
To: <pgsql-sql@postgresql.org>
Sent: Wednesday, March 05, 2003 3:45 AM
Subject: [SQL] DELETE FROM A BLACK LIST


>
> Hi all,
> I have a Blacklist table containing about 1000 ID to delete from another
> table (T1 about 1440294 records)
> If i use the SQL
>
> DELETE FROM T1 WHERE T1.ID IN (SELECT BLACKLIST.ID FROM BLACKLIST)
>
> the operation is very slow .
>
> There is a faster way to do the same operation??
>
> Thanks
> Luca
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>