Обсуждение: [HACKERS] proposal: custom autovacuum entries

Поиск
Список
Период
Сортировка

[HACKERS] proposal: custom autovacuum entries

От
Jordan Deitch
Дата:
Hi hackers,

I would like to remove records from a time series table older than a certain age. My understanding of current standard practice is to configure an external scheduler like cron to perform the deletion.
My proposal is to allow clients to register functions on the tail end of the autovacuum sequence. 
Alternatively I would suggest some mechanism for scheduling within PostgreSQL


Thanks,
Jordan Deitch

Re: [HACKERS] proposal: custom autovacuum entries

От
Tom Lane
Дата:
Jordan Deitch <jwdeitch@gmail.com> writes:
> I would like to remove records from a time series table older than a
> certain age. My understanding of current standard practice is to configure
> an external scheduler like cron to perform the deletion.
> My proposal is to allow clients to register functions on the tail end of
> the autovacuum sequence.

There's already a mechanism for writing custom background workers.
I doubt that adding random user-defined stuff to what autovacuum has
to do is a better idea; that will mostly make autovac scheduling even
harder than it is now.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] proposal: custom autovacuum entries

От
Michael Paquier
Дата:
On Thu, Oct 26, 2017 at 1:47 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Jordan Deitch <jwdeitch@gmail.com> writes:
>> I would like to remove records from a time series table older than a
>> certain age. My understanding of current standard practice is to configure
>> an external scheduler like cron to perform the deletion.
>> My proposal is to allow clients to register functions on the tail end of
>> the autovacuum sequence.
>
> There's already a mechanism for writing custom background workers.
> I doubt that adding random user-defined stuff to what autovacuum has
> to do is a better idea; that will mostly make autovac scheduling even
> harder than it is now.

I agree with Tom here, there is no point to have more facilities in
autovacuum so as it does extra work at its tail. There may be not even
any need to develop your own background worker. Have you looked at
pg_cron [1]?

[1]: https://github.com/citusdata/pg_cron
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers