From: | frbn <frbn(at)efbs-seafrigo(dot)fr> |
---|---|
To: | Dorward Villaruz <dorwardv(at)ntsp(dot)nec(dot)co(dot)jp> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: deletion of records |
Date: | 2002-07-12 07:38:39 |
Message-ID: | 3D2E877F.9050900@efbs-seafrigo.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
DELETE FROM custinfo,custinfotemp
WHERE
custinfo.UserID=custinfotemp.userid
and
custinfotemp.updateStatus='D'
;
should avoid the 2.10^6 selects
Dorward Villaruz a écrit:
> can anybody help me with this one
>
> i want to delete rows from one table based values from another table.
>
> here is the scenario
>
> i have a table named custinfo which contain 2000000 records and a table
> custinfotemp which contain 30000 records. i want to delete all records
> in custinfo where the cust_id is found on custinfotemp where it's update
> status is 'D'
>
> here is my sql statement
>
> psql -h $HOSTNAME -d $DBNAME -c "DELETE FROM custinfo WHERE
> custinfo.UserID IN (SELECT custinfotemp.userid FROM custinfotemp where
> updateStatus='D')";
>
> is it possible that this query statement takes 24 hours and still
> running to execute?
>
> is there a way to achieve the same result faster?
>
> thanks.
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Liddicott | 2002-07-12 07:43:25 | Re: I am being interviewed by OReilly |
Previous Message | Martijn van Oosterhout | 2002-07-12 07:38:08 | Re: again trouble |