| От | Peter Alberer |
|---|---|
| Тема | delete operation with "where XXX in" |
| Дата | |
| Msg-id | 000001c26327$6af32830$5be0d089@ekelhardt обсуждение исходный текст |
| Ответы |
Re: delete operation with "where XXX in"
|
| Список | pgsql-general |
Hi,
is there a way to speed up a delete operation that currently uses a „where XX in” clause?
The following query takes quite long:
delete from lr_object_usage where lr_object_usage_id in (
select lr_object_usage_id from lr_locked_objects where timeout_time < now() and context is not null
);
to get the rows I want to delete into a select query I can simply use
select * from lr_object_usage lrou inner join lr_locked_objects llo
on llo.lr_object_usage_id = lrou.lr_object_usage_id
where llo.timeout_time < now() ;
But how can i rephrase the delete operation to get a fast delete operation? I tried also to use “exists” instead of “in” but that did not help either.
Many TIA,
peter
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера