From: | Chris Albertson <chrisalbertson90278(at)yahoo(dot)com> |
---|---|
To: | Dorward Villaruz <dorwardv(at)ntsp(dot)nec(dot)co(dot)jp>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: deletion of records |
Date: | 2002-07-12 18:03:34 |
Message-ID: | 20020712180334.17995.qmail@web14707.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
--- Dorward Villaruz <dorwardv(at)ntsp(dot)nec(dot)co(dot)jp> wrote:
>
> 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')";
Try this
DELETE FROM custinfo
WHERE
custinfo.UserID = custinfotemp.userid AND
custinfotemp.updateStatus = 'D';
It would be good to have indexs on UserID on both tables.
Seeing a table named "custinfotemp" kind of raises a red
flag. Possibly you may want to re-think the design if
you are moving data between tables that is really the
same data.
=====
Chris Albertson
Home: 310-376-1029 chrisalbertson90278(at)yahoo(dot)com
Cell: 310-990-7550
Office: 310-336-5189 Christopher(dot)J(dot)Albertson(at)aero(dot)org
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Reina | 2002-07-12 18:58:07 | Re: 7.2.1 optimises very badly against 7.2 |
Previous Message | Rune Teigen | 2002-07-12 17:54:16 | PostgreSQL in mission-critical system |