Re: Delete performance

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Delete performance
Дата
Msg-id 21389.1245091612@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Delete performance  (Phillip Sitbon <phillip@sitbon.net>)
Список pgsql-novice
Phillip Sitbon <phillip@sitbon.net> writes:
> I've had to do this quite a bit, and here's how I usually go about it:

> DELETE FROM data_structures_items WHERE NOT EXISTS
>   (SELECT 1 FROM data_structures WHERE id_structure=id_data_structure LIMIT 1);

> Even when the item in the subquery is a primary key, I find it
> semantically informative to always use "LIMIT 1".

EXISTS implies LIMIT 1 for its subquery; there's no value for either
comprehension or performance in adding that.  I'd recommend leaving
it off, because it makes your query syntax nonstandard for no benefit.

            regards, tom lane

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

Предыдущее
От: Phillip Sitbon
Дата:
Сообщение: Re: Delete performance
Следующее
От: Tim
Дата:
Сообщение: Fwd: Yum Update Errors