Domanda

I'm relatively new to PostgreSQL administration and I'm attempting to pick up the nitty gritty details as I go. My question is, assuming I have no need for disaster recovery and I don't turn on archiving by setting up archive_mode = on, does Postgres have an internal mechanism to rotate WAL files out of pg_xlog? if so, what is the frequency?

On a slightly different note, what is the impact of setting archive_mode = on but not configuring an archive_command - is there a default location Postgres will attempt to archive to?

È stato utile?

Soluzione

If archive_mode = off, PostgreSQL will delete old WAL files as soon as they are older than the latest checkpoint. These checkpoints occur by default at least every 5 minutes, so there should never be many old WAL files around.

If you set archive_mode = on, a WAL file are only deleted once archive_command has returned success for that file. An empty archive_command should always do that immediately. It is a tradition to set archive_command = '/bin/true' to indicate that you temporarily disabled archiving.

Altri suggerimenti

I'm relatively new to PostgreSQL administration

assuming I have no need for disaster recovery ...

Really?

Why do organisations employee Postgres Administrators?

Could it be so that they have someone who's job it is to ensure that their Data is recoverable?

Any Data that you don't have [at least] two copies of is Data that you don't care about. You business probably does.

what is the impact of setting archive_mode = on but not configuring an archive_command

Postgres will quite happily fill up your disk with WAL files, right up to the point where it can't write any more of them, at which point your database will crash and burn.

Postgres will not attempt to archive these files for you because the only way it knows how to archive them is the archive_command that you configure.

It either deletes or recycles (renames to some future WAL name, for future reuse) unneeded WAL files at the end of each checkpoint.

On a slightly different note, what is the impact of setting archive_mode = on but not configuring an archive_command - is there a default location Postgres will attempt to archive to?

The default setting of archive_command is '', about which which the docs say:

If you wish to temporarily stop archiving, one way to do it is to set archive_command to the empty string (''). This will cause WAL files to accumulate in pg_wal/ until a working archive_command is re-established.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange
scroll top