Re: deletion of records

Поиск
Список
Период
Сортировка
От Chris Albertson
Тема Re: deletion of records
Дата
Msg-id 20020712180334.17995.qmail@web14707.mail.yahoo.com
обсуждение исходный текст
Ответ на deletion of records  ("Dorward Villaruz" <dorwardv@ntsp.nec.co.jp>)
Список pgsql-general
--- Dorward Villaruz <dorwardv@ntsp.nec.co.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@yahoo.com
  Cell:   310-990-7550
  Office: 310-336-5189  Christopher.J.Albertson@aero.org

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Elaine Lindelef
Дата:
Сообщение: Re: MySQL vs. PostgreSQL
Следующее
От: reina@nsi.edu (Tony Reina)
Дата:
Сообщение: Re: 7.2.1 optimises very badly against 7.2