Re: Partitioning by status?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Partitioning by status?
Дата
Msg-id 4F0F2564.6030702@agliodbs.com
обсуждение исходный текст
Ответ на Partitioning by status?  (Mike Blackwell <mike.blackwell@rrd.com>)
Ответы Re: Partitioning by status?  (alexandre - aldeia digital <adaldeia@gmail.com>)
Список pgsql-performance
Mike,

> Is it practical to partition on the status column and, eg, use triggers to
> move a row between the two partitions when status is updated?  Any
> surprises to watch for, given the status column is actually NULL for active
> data and contains a value when archived?

When I've done this before, I've had a setup like the following:

1. One "active" partition

2. Multiple "archive" partitions, also partitioned by time (month or year)

3. stored procedure for archiving a record or records.

I'd recommend against triggers because they'll be extremely inefficient
if you need to archive a large number of rows at once.

Also, (2) only really works if you're going to obsolesce (remove)
archive records after a certain period of time.  Otherwise the
sub-partitioning hurts performance.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

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

Предыдущее
От: Matteo Sgalaberni
Дата:
Сообщение: Re: partitioned table: differents plans, slow on some situations
Следующее
От: Tomas Vondra
Дата:
Сообщение: wal_level=archive gives better performance than minimal - why?