Search Postgresql Archives

Re: Problem with reading data from standby server ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/04/12 09:39, Condor wrote:
Hello,

when I read binary replication tutorial
(http://wiki.postgresql.org/wiki/Binary_Replication_Tutorial) I see on
Hot Standby: Hot Standby is identical to Warm Standby, except that the
Standby is available to run read-only queries.
I setup hot standby server described in tutorial and it's working fine,
no problem with that.


> I have a problem when I try to start a script that
should read whole table, error message from php is:

PHP Warning: pg_query(): Query failed: ERROR: canceling statement due to
conflict with recovery

When data is fetched it's saved into a file after some modifications.
This script is work a 30-40 min until all data is parsed. Well, I think
problem is started when master server send new wal file to slave, but
how I can resolve that problem ?

Your master database is being updated all the time and your slave is supposed to be a perfect copy, including deleted/updated rows being no longer visible. So - when you run a query it might need to do one of two things:
  1. Pause replication
  2. Cancel the query

At some point PostgreSQL switches from doing #1 to doing #2 (otherwise you could get so far behind the replica could never catch up). You can control how long before it switches:

http://www.postgresql.org/docs/9.1/static/hot-standby.html#HOT-STANDBY-CONFLICT


--
  Richard Huxton
  Archonet Ltd

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux