"Chris Hoover" <revoohc@xxxxxxxxx> writes: > I am able to tell how far behind the archiving is running since every > minute, I copy the current archive_logs to a backup directory. This is > allowing me to be able to do an up to the minute pitr if required. The > archive_command removes the file from this backup dir when the file is > archived by PostgreSQL. > Here my script for that: It looks to me like your script does not understand the difference between xlog files that have been used and xlog files that haven't been used yet. Since you've got checkpoint_segments = 256, the xlog code will allow as many as 513 (2*checkpoint_segments+1) not-yet-used xlog files to be allocated. The only simple way to tell where the end of WAL is at the moment is to look for the xlog file with the latest mod time. (There'll be more support for this in 8.2.) Any files with names numerically larger than that one are just sitting there waiting to be used, they are not interesting for archiving purposes. regards, tom lane