Re: [PERFORMANCE] slow small delete on large table

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: [PERFORMANCE] slow small delete on large table
Дата
Msg-id 403AB818.9090100@familyhealth.com.au
обсуждение исходный текст
Ответ на [PERFORMANCE] slow small delete on large table  ("Ed L." <pgsql@bluepolka.net>)
Список pgsql-performance
> Of course, that's not legal 7.3.4 syntax.  These are both too
> slow due to sequential scan of table:
>
>     delete from mytable where key in (
>         select key
>         from mytable
>         where posteddatetime < now() - '90 days'
>         limit 100);

Upgrade to 7.4 - the query above will be vastly faster.

>     delete from mytable where exists (
>         select m.key
>         from mytable m
>         where m.key = mytable.key
>           and m.posteddatetime < now() - '90 days'
>         limit 100);

That one I used to use on 7.3 - I seem to recall it indexed nicely.

Chris

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

Предыдущее
От: "Ed L."
Дата:
Сообщение: [PERFORMANCE] slow small delete on large table
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: [PERFORMANCE] slow small delete on large table