Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f66aF-0007ZH-Vi for pgsql-general@arkaria.postgresql.org; Wed, 11 Apr 2018 03:38:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f66aE-00067H-5Z for pgsql-general@arkaria.postgresql.org; Wed, 11 Apr 2018 03:38:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f66aD-000678-TR for pgsql-general@lists.postgresql.org; Wed, 11 Apr 2018 03:38:05 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f66a5-0002U5-DG for pgsql-general@lists.postgresql.org; Wed, 11 Apr 2018 03:38:05 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 93F3D21468; Tue, 10 Apr 2018 23:37:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 10 Apr 2018 23:37:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=oUdcpkP+0J1she5LV3ZD4+wFH641WNOdu1x6xYg/f9w=; b=eeXEILlr SlCqYCv6P8sARZ4Q0UeyIRb31DJa/0uBywZVDwwEtPWHK2DaoNUbNp96nYmGSHZC SxOE0Y3kxf0+lx1wfjNigE+F7KVHwaGbi4l13mJrH9wVfxN/w3mBQuTIlypz39GA PDt6xSeShpZ2Wubeas66rk6fxpXyA3hF0y3KNtJStAu1eicKjexRQ7//WZvv0KLb sXxwdLByPKQfRCAUtJCanU1bFkoQ3o7xsePxyDvHU10WSx7OmXehXElzuYFeOaaP R87v0b1AaFOPPixuPX6zSR4dQ2qBHikgsPeLW2jr0Obdbyk4ii2a/utibss0VwyX Yny0JQP0fih27A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=oUdcpkP+0J1she5LV3ZD4+wFH641W NOdu1x6xYg/f9w=; b=AjnQk5TenJIE04AP25cz3FkAeSyxq2CGv5DOjH7+qfxbM iGVjUwBimwK+hHKtMmAQaOcn50ACcxv7AxN9LU/ZraOkSjJfD9KSKE2/oTGA8+dW hXaPX4Hq+lyiy1cZM4EudBmQ/H6iQxYeSz4R9Fckn8X4eB/zpFr1GMNUunMr5zNx sGRuTPiVf4oonrlSJmyRUF6fKwf7NOlJ/ZQn2Eg0nuD8HOnmmrD28sGpD9B1RqKA nA/v6clZdLPz1HvIBfJxnpoVPzAPrW6Jfx+b2nroxq2ZYAK3Zpor+sqoQ8CvmEzR iBFHKJhEhs/K/rU0M6jCCq2quV0MXSHEOahno+HpA== X-ME-Sender: Received: from paquier.xyz (mp76f1f8ba.ap.nuro.jp [118.241.248.186]) by mail.messagingengine.com (Postfix) with ESMTPA id 0FEE7E46C1; Tue, 10 Apr 2018 23:37:53 -0400 (EDT) Date: Wed, 11 Apr 2018 12:37:50 +0900 From: Michael Paquier To: Raghavendra Rao J S V Cc: pgsql-general@lists.postgresql.org Subject: Re: difference between checkpoint_segments and wal_keep_segments in postgres configuration file Message-ID: <20180411033750.GA19732@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="X1bOJ3K7DJ5YkBrT" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 10, 2018 at 11:06:54PM +0530, Raghavendra Rao J S V wrote: > I am not clear the difference between checkpoint_segments and > wal_keep_segments . >=20 > I would like to now below things. Please explain.Thanks in advance. >=20 > - Difference between *checkpoint_segments *and *wal_keep_segments * > value > - Role of *checkpoint_segments *and *wal_keep_segments * > - Which one should has higher value. Documentation is king here. For checkpoint_segments: https://www.postgresql.org/docs/9.4/static/runtime-config-wal.html#RUNTIME-= CONFIG-WAL-CHECKPOINTS Maximum number of log file segments between automatic WAL checkpoints (each segment is normally 16 megabytes). The default is three segments. Increasing this parameter can increase the amount of time needed for crash recovery. This parameter can only be set in the postgresql.conf file or on the server command line. For wal_keep_segments: https://www.postgresql.org/docs/9.4/static/runtime-config-replication.html#= RUNTIME-CONFIG-REPLICATION-SENDER Specifies the minimum number of past log file segments kept in the pg_xlog directory, in case a standby server needs to fetch them for streaming replication. Each segment is normally 16 megabytes. If a standby server connected to the sending server falls behind by more than wal_keep_segments segments, the sending server might remove a WAL segment still needed by the standby, in which case the replication connection will be terminated. Downstream connections will also eventually fail as a result. (However, the standby server can recover by fetching the segment from archive, if WAL archiving is in use.) Mentioning checkpoint_segments implies that you are using PostgreSQL 9.4 or older versions as this has been removed and replaced by max_wal_size in 9.5. You should consider upgrading to a newer version. Hence the first is used in the context of normal operations to decide the frequency of checkpoints when those are triggered by volume. The second can be used with streaming replication to give a standby a higher catchup window. Giving value to one or the other depends on the context, and both are usable in completely different circumstances. -- Michael --X1bOJ3K7DJ5YkBrT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlrNgw4ACgkQnvQgOdby QH3qLw//X7QmqdEKOTzjCZOwLm31zo4lT6O9yFpkHi9XcK3UhBBe4djyileznpa5 n1S3bEznwqGx16hQg7XHI5Fic9WLe/jqGH0TgdYc2LdKsFkDa4IaPYnNvrPQp94m 2WTx+Q9Qp0lJ/wFeQ8bT7nlXzJ9rTaqqyP4p0DcAFqwIqUGJMO9KZnCKZWJxv36A d+1NMEqDi0HgtcZEaWFmtsbrgcAwjK/91tTC0MCu9nC0LFDiXEwk8EODDzVMOzp7 q5RROPhMOIYLQ/mslPNcnWwbPb56Eu+pCoUTxrOwfQ9QJx2uqvxOf5MaCBCUB8be s86HNb05OhgCCWAU1HoWMW35vHqRwkSxL320gD218G2eT7bc3UnEt9mZQKvF92rG w2DKTyhDkPLkUhU1HEsWhRksCbhXpeP4B0wlRXFu+QzNUHXrnOpM0DXbeHz3fCGK auyLIWM50jjSc03wY+ZD/pv22F2SSPl+dFWNHFuMPROaD3XO1lrmrehK5i3nFXyT AUnkIE9KtGn54RdbRz/CJ+Rcnhm6whp/OLtRfaQWZ5gXUrO+uG5cu6XPFM/+rjgT 8mf3ZQFHeEfraq3Gm1bath1PDhPLo7Y97uLMQ5oOjYETMygMQT9MzlEf0pqjwJrk lgk4BLVQHajfZR+rPY58aWHLq52JNvVK2+sVbXhag4mVY7C7vMk= =ZPwQ -----END PGP SIGNATURE----- --X1bOJ3K7DJ5YkBrT--