Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I use the following archive_command archive wal files ,suppose I have touched the file archive_active already.and I want to konw when will PostgreSQL execute archive_command to archive wal files?

I know we can use function pg_switch_xlog() to archive wal , will anybody can list all the trigger conditions? PostgreSQL version: 9.3.0.

--postgresql.conf

archive_command = 'test ! -f /archive/pg93/archive_active || cp %p /archive/pg93/%f'
wal_level = hot_standby
archive_mode = on

--archive directory

[pg93@redhatB pg93]$ pwd
/archive/pg93

[pg93@redhatB pg93]$ ll
total 32M
-rw-------. 1 pg93 pg93 16M Oct 16 11:05 00000001000000000000007A
-rw-------. 1 pg93 pg93 16M Oct 16 11:07 00000001000000000000007B
-rw-rw-r--. 1 pg93 pg93   0 Oct 16 11:05 archive_active
share|improve this question
    
What are the values for wal_level and archive_mod? –  Milen A. Radev Oct 16 '13 at 8:17
    
@MilenA.Radev, I edited the question, and add the wal_level and archive_mod . –  francs Oct 16 '13 at 8:24

1 Answer 1

The archive command is executed every time it switches the archive log to a new one. Which as you say can be triggered manually by calling the pg_switch_xlog() function.

Other than that, an archive log needs to be changed to a new one when it is full, which by default is when it reaches 16MB, but can be changed at compile time.

You can also specify a timeout value using the parameter archive_timeout which will execute the command after the set amount of seconds, which is useful for databases that have low activity.

share|improve this answer
    
Thank you very much , you are right. –  francs Oct 17 '13 at 1:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.