Re: Delete all records NOT referenced by Foreign Keys

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Delete all records NOT referenced by Foreign Keys
Дата
Msg-id 20031214061724.GD30016@svana.org
обсуждение исходный текст
Ответ на Re: Delete all records NOT referenced by Foreign Keys  ("D. Dante Lorenso" <dante@lorenso.com>)
Ответы Re: Delete all records NOT referenced by Foreign Keys
Список pgsql-general
On Sat, Dec 13, 2003 at 09:48:16PM -0600, D. Dante Lorenso wrote:
> This is something very ugly indeed and is what I'll have to resort to unless
> I can find something cleaner.  Ideally, I would be able to run this cleanup
> on a subset of the table data after an insert into the table.  I would like
> the query to be fast, though.

What about just:

delete from a where a.id not in (select id from b);

or the equivalent exists query.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> (... have gone from d-i being barely usable even by its developers
> anywhere, to being about 20% done. Sweet. And the last 80% usually takes
> 20% of the time, too, right?) -- Anthony Towns, debian-devel-announce

Вложения

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

Предыдущее
От: "Keith C. Perry"
Дата:
Сообщение: Re: tablespaces in 7.5?
Следующее
От: "D. Dante Lorenso"
Дата:
Сообщение: Re: Delete all records NOT referenced by Foreign Keys