Re: Keepalive for max_standby_delay

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: Keepalive for max_standby_delay
Дата
Msg-id 20100603004710.GO21875@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: Keepalive for max_standby_delay  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Greg Stark <gsstark@mit.edu> writes:
> > So I think this isn't necessarily such a blue moon event. As I
> > understand it, all it would take is a single long-running report and a
> > vacuum or HOT cleanup occurring on the master.
>
> I think this is mostly FUD too.  How often do you see vacuum blocked for
> an hour now?  It probably can happen, which is why we need to be able to
> kick queries off the locks with max_standby_delay, but it's far from
> common.  What we're concerned about here is how long a buffer lock on a
> single page is held, not how long heavyweight locks are held.  The
> normal hold times are measured in microseconds.

Maybe I'm missing something, but I think Greg's point was that if you
have a long-running query running against the standby/slave/whatever,
which is holding locks on various relations to implement that report,
and then a vacuum or HOT update happens on the master, the long-running
report query will get killed off unless you bump max_streaming_delay up
pretty high (eg: 60 mins).

That being said, I'm not sure that there's really another solution.
Yes, in this case, the slave can end up being an hour behind, but that's
the trade-off you have to make if you want to run an hour-long query on
the slave.  The other answer is to make the master not update those
tuples, etc, which might be possible by starting a transaction on the
master which grabs things enough to prevent the vacuum/hot/etc update
from happening.  That may be possible manually, but it's not fun and it
certainly isn't something we'll have built-in support for in 9.0.
Thanks,            Stephen

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Allow wal_keep_segments to keep all segments
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: ALTER TABLE .... make constraint DEFERRABLE