Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNa0m-004qMR-Na for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jun 2025 16:33:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uNa0k-00DYkr-EK for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jun 2025 16:33:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNa0k-00DYkh-2v for pgsql-hackers@lists.postgresql.org; Fri, 06 Jun 2025 16:33:42 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uNa0i-000ZdB-2u for pgsql-hackers@lists.postgresql.org; Fri, 06 Jun 2025 16:33:42 +0000 Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-86cfe449f06so57473839f.0 for ; Fri, 06 Jun 2025 09:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749227618; x=1749832418; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=n8IzzhNI3Y3daPAILO8Rbg5Bx5T/tpkRb3ESr1U97lM=; b=Ic3R8c+PuC9JI24y5RbUX3kgaMRUbmSaPNyLplGuAVOtmQtY42T0S9J559dJ+wdwJL 0lE8gXm9R0LdmTUDAGFqV7wNQc/U41rcJaFRN5dYdW4IyjoeyZXQw9QFzlVegOfgaUsy DDu6q4lhLx4Z3NJuqEUj69LcJzZecoTwkESEO0WIXFn7ht21WDGArxJm5GjxN30DGhrH V4Dl0YWDmx0Y6aysYSaXn/rgtwOx56GGqt5jYUWoZ+9HnkRf2pMZVMDh5Y6L94KpilKR 4S4ets+/GwoIFB8GVKBqX5jcBbJU/i2zZga3JHCf7YZedKkvaARgmYb7PuPDIzNyWhwM B9Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749227618; x=1749832418; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=n8IzzhNI3Y3daPAILO8Rbg5Bx5T/tpkRb3ESr1U97lM=; b=R+DueIwETnjN7rr78eiwguWPFwhs/uVvOEoU0y/3IiFGcE90rjorGW2nIX+kNHo5zB TOpu7RKYywMejjONKfDcXcDyNLciOHTHNSTqtlLiCSgRWRDw2Io6uMYwmOo+wgU5AQFk G5cH70e62DY/wc19oJnM50Z7z/TZrFXziPvg2Wtu9KH5bcOpknf6ZxTHA8eArfwFkdqz 0IgHyX++SB4hzXK4NQ4Ha9kgOpcM9KfZTj62hJeWK4YoSmYyzCELdYxHLthJt0Aq/4my CHSAzLjToRdeEmZibyNH/htN6xu5Omsq+t0CNhDxVUr7jsA4KiI43zHBKtcTTIoBpJmi /15Q== X-Forwarded-Encrypted: i=1; AJvYcCUdaeY4RAMFirGDKe9gJuQgKMzwkE+OrsquuWnOHhJ/hbon50d2itUdGMNkZC9EsDs56CHIpimgZlmQlEB6@lists.postgresql.org X-Gm-Message-State: AOJu0YznZKtjFqDbHDH9qiCoXa0aOfOdCWGXPoK3q0MJ7CJjUsI2iBvW 0z6JFrjySPJbp6jW7icN76hKH2m6QlL1P41JhEGJ23pdNR1FQ/JApHGQ X-Gm-Gg: ASbGncvdvkIDGeTKUBO2hk1xzFIkpj96TBhumDuyS+nXfZ92SBSENvWpLUvLjeC1CJ/ OkUDIrxsx1l1nAwaAE1Y1+TxR9iqBL/V4pu307UM3d1AoQ0LuGQtUO01LU/SpHxb5mG8Ddj0dZ1 NIXLBZFnPhxHZxrQSXlmlmPIXbs/eLyBMVi7XLseNlAHZrYiW6TQyubnJ+1IVygp/FZZc47wYmR 4yi+zM2705iyOTh0hZQBQRQJyIAEIMT1oh2t5sFOKhtS/nc3rZdcL5DMWv7nDm3utGbpTq4LEsz dllcEU08Bj1g1n2Iz7bqBWz2KB3euuFw61g2pTD0qejO27yX0LUp35zLUpuQziLoj+RB3sOq5gC aYBt9yNTr7gKyPfL+RLj/7FyN2HGODtldtPQUEd/kYA== X-Google-Smtp-Source: AGHT+IHjrCtfudNdOMGqwvhN/uyz/omT0PWNuoPbn2VCaNYNMhJN2rwgI3G5Ns8P5LntM/9yE83vPQ== X-Received: by 2002:a05:6602:481a:b0:864:a2e4:5fff with SMTP id ca18e2360f4ac-87336647875mr622020139f.4.1749227618140; Fri, 06 Jun 2025 09:33:38 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-500df3f6418sm510839173.27.2025.06.06.09.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jun 2025 09:33:37 -0700 (PDT) Date: Fri, 6 Jun 2025 11:33:36 -0500 From: Nathan Bossart To: Christoph Berg Cc: Fujii Masao , Andres Freund , PostgreSQL Hackers Subject: Re: CHECKPOINT unlogged data Message-ID: References: <7x6gsmev36zzh6lfzydkddbhpnxqgu2k2l2ci2k6foxhrstvj2@bn55g54wjrl4> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 06, 2025 at 06:20:21PM +0200, Christoph Berg wrote: > Re: Nathan Bossart >> I don't understand why we need to add both FAST and IMMEDIATE. > > We have both: > > =# checkpoint ; > 2025-06-06 18:09:25.743 CEST [872379] LOG: checkpoint starting: immediate force wait > > pg_basebackup --checkpoint=fast > > Could we settle for one official name for that? Then we could use that > name in all contexts. That seems like a good idea to me. I'm tempted to say that "fast" more accurately describes what's happening than "immediate." "Immediate" sounds like it happens instantaneously, but it's actually just happening "fast," i.e., as fast as possible. >> > + FLUSH_ALL >> >> Could we rename this to something like FLUSH_UNLOGGED or INCLUDE_UNLOGGED? >> IMHO that's more descriptive. > > That's again coming from what the log message is saying: > > =# checkpoint (flush_all); > 2025-06-06 18:12:46.298 CEST [873436] LOG: checkpoint starting: immediate force wait flush-all > > I think we should be consistent there. > > #define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those > * belonging to unlogged tables */ > > Maybe CHECKPOINT_FLUSH_UNLOGGED would be more explicit? WFM. >> My attempt at this patch back in 2020 included the following note, which >> seems relevant here: >> >> + Note that the server may consolidate concurrently requested checkpoints or >> + restartpoints. Such consolidated requests will contain a combined set of >> + options. For example, if one session requested an immediate checkpoint and >> + another session requested a non-immediate checkpoint, the server may combine >> + these requests and perform one immediate checkpoint. > > The CHECKPOINT documentation links to `28.5. WAL Configuration`, > should this be mentioned there instead? I thought it would make sense to put it closer to where these options are described, since it'll be most evident for manually-initiated checkpoints. >> We might also want to make sure it's clear that CHECKPOINT does nothing if >> there's been no database activity since the last one (or, in the case of a >> restartpoint, if there hasn't been a checkpoint record). > > That's taken care of by "force": > > #define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */ Oh, I see that we always specify that for CHECKPOINT commands, except for restartpoints. IIRC even if you do specify CHECKPOINT_FORCE for a restartpoint, it'll have no effect. It's proably worth mentioning that case, at least. -- nathan