pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Postgres 9 slave lag
2+ messages / 2 participants
[nested] [flat]

* Postgres 9 slave lag
@ 2011-04-11 14:12 Saurabh Agrawal <saurabh.miet@gmail.com>
  2011-04-11 21:46 ` Re: Postgres 9 slave lag Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 2+ messages in thread

From: Saurabh Agrawal @ 2011-04-11 14:12 UTC (permalink / raw)
  To: pgsql-admin

Hi All,

I have setup postgres 9 master slave streaming replication but
experiencing slave lagging sometimes by 50 min to 60 min. I am not
getting exact reason for slave lag delay. Below are the details:

1. Master table contains partition tables with frequent updates.
2. Slave is used for report generation so long running queries hit slave.
3. ANALYZE runs every hour on partition table on master.
4. postgresql.conf:
archive_timeout = 900
checkpoint_segments = 500
checkpoint_timeout = 30min
checkpoint_warning = 2000s
max_standby_archive_delay = -1

I noticed that whenever long running query executes on slave, slave
starts lagging by master and as soon as query completes log files get
applied immediately. Please help how can I avoid slave lag.

Thanks

Regards
Saurabh Agrawal



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Postgres 9 slave lag
  2011-04-11 14:12 Postgres 9 slave lag Saurabh Agrawal <saurabh.miet@gmail.com>
@ 2011-04-11 21:46 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 0 replies; 2+ messages in thread

From: Kevin Grittner @ 2011-04-11 21:46 UTC (permalink / raw)
  To: Saurabh Agrawal <saurabh.miet@gmail.com>; pgsql-admin

Saurabh Agrawal <saurabh.miet@gmail.com> wrote:
 
> max_standby_archive_delay = -1
> 
> I noticed that whenever long running query executes on slave,
> slave starts lagging by master and as soon as query completes log
> files get applied immediately. Please help how can I avoid slave
> lag.
 
You can adjust max_standby_archive_delay to the maximum amount of
time you want replication to block waiting for your query.  If that
is exceeded, your query will be canceled to allow replication to
continue.
 
http://www.postgresql.org/docs/9.0/interactive/hot-standby.html#HOT-STANDBY-CONFLICT
 
-Kevin



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-04-11 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-11 14:12 Postgres 9 slave lag Saurabh Agrawal <saurabh.miet@gmail.com>
2011-04-11 21:46 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox