Re: Chunk Delete

Поиск
Список
Период
Сортировка
От Alexander Staubo
Тема Re: Chunk Delete
Дата
Msg-id 88daf38c0711150252l4a0d6962g8b6da8044c7ad0a2@mail.gmail.com
обсуждение исходный текст
Ответ на Chunk Delete  ("Abraham, Danny" <danny_abraham@bmc.com>)
Список pgsql-general
On 11/15/07, Abraham, Danny <danny_abraham@bmc.com> wrote:
> In Oracle we erase 50,000 records using the following:
>
> Delete <table name> where <condition> and ROWNUM < 50000;
>
> Do we have such a feature in PG?

Just delete with a subselect:

  delete from <table name> where <primary key> in (
    select <primary key> from <table name> order by <some sort key>
limit 50000);

For example:

  delete from persons where id in (
    select id from persons order by created_at limit 50000);

Alexander.

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

Предыдущее
От: "Abraham, Danny"
Дата:
Сообщение: Chunk Delete
Следующее
От: Kristo Kaiv
Дата:
Сообщение: implicit casting bug or feature?