Re: How many records to delete ?

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: How many records to delete ?
Дата
Msg-id 4B4580BC.8010306@hogranch.com
обсуждение исходный текст
Ответ на How many records to delete ?  (shulkae <shulkae@gmail.com>)
Список pgsql-general
shulkae wrote:
> I am writing a shell script which runs as a cron entry. The objective
> is to delete older records from postgresql DB.
>
> I have thousands of records. What is the optimum number of records to
> delete in one delete command
>

as many as you need to,

    DELETE FROM yourtable AS t
        WHERE CURRENT_DATE - t.recorddate < INTERVAL '90 days';

or whatever.   pooof, all records over that given parameter are deleted,
about as efficiently as can be.   of course, as always, the space
doesn't get reclaimed until that table is vacuumed.



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

Предыдущее
От: Rikard Bosnjakovic
Дата:
Сообщение: Re: How many records to delete ?
Следующее
От: Yan Cheng Cheok
Дата:
Сообщение: Use C++ to iterate integer array returned from stored procedure