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 1uNYxu-004Vyg-SG for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jun 2025 15:26:42 +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 1uNYxs-00CTNg-Vr for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jun 2025 15:26:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNYxs-00CTMc-Gj for pgsql-hackers@lists.postgresql.org; Fri, 06 Jun 2025 15:26:41 +0000 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uNYxr-000bB9-1t for pgsql-hackers@lists.postgresql.org; Fri, 06 Jun 2025 15:26:40 +0000 Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-86d1131551eso65498739f.3 for ; Fri, 06 Jun 2025 08:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749223599; x=1749828399; 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=sWriLjBrwt3FfdyLZD44+e4PV+G1osECZBdMClNxxtQ=; b=YE+4br/QXgTR2y/QvLba6gNh96kHq4Nc9EqPe9VDevAdpRT6o1dxJpSKsGRezsHtXh fJBTbQ0/eBAkY02yWDWtQgIT4oCijTbEMDUfZ6EGOh1BwrvB5+Jb+TAcY3bYphiMEMm7 X1MD/3j9ICpk8eAQgF6lMyEEB8RWFJj/SeEJIbBxGakBhIB5QaYOKEg024FY8NZBiKz8 i/LGSs9ybwhp9Rl+5+ohv6r05CT3Ex9J4qf5gw4f7IqzAnyexzy9wpIdi9bkiER7roZN nC8QsfugUOa38Xoozec2MEigRRr2ilH3nVJ+J7elKX+GHtW5EWu0FmO2AJah+vjqsMrL gnCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749223599; x=1749828399; 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=sWriLjBrwt3FfdyLZD44+e4PV+G1osECZBdMClNxxtQ=; b=nT/dUlHgxH3TuspUwM0l133vLCfZdlXMZhyYz6U7cV8aFKx2mH/1ZXf8dW3weY/phV XWn8MWueVuMwCLGUHkirHUZ6cm/zwNBU5scq3Pi5UiyN13QJ91J/TPnYPqGGaKulE4ip zo1wkSZUSYrD8DhG1AtWEvT2YqzT0nBRRRersMUWcXcVlcPBGOhtrVxgHgSOH9hA/obp +3LqdSj6vTYNmHRFlb8oYPgZMW80spjKlrV/jE2HYUUWbdvCFaVUli3fNKiQjkMkIQj3 xTmT5aigCsgqBxhFHq7jUMJcdDZ5vRqJMqPFkVfZSG1mKggngtRmwscGZC+M7LY5ESr7 hvlw== X-Forwarded-Encrypted: i=1; AJvYcCWsIFkOd0ej4ZsM3q3aLl5aGJ8fxMPpZvdZyfhc8vDa7NcAfRjKkpHSZHCD/AqV6gmyTlplm5+6jIqn0u4H@lists.postgresql.org X-Gm-Message-State: AOJu0YxPi9MkfSXbYgfAG28O5r6MHzoPGtntDXjWUz/9BGrcsWSq9S5B /RdWfv6ghVM2EWvCJeFzbejUIgwLdofhaS6uOgz9bw4c+HXjQLtUjCCL X-Gm-Gg: ASbGncsVLWIf6rRa5ltxlME6oFEx/6EW1Y1HUo5T8CSbUgek2ODJKKXfcYGMdYCSAXY qNyPirkdzSZtLvGKYilfoOTOE0HIxvxz+M7N5dt2rq1yV3qbAUK5wc+NcNGhV8gdiFxzAV9Dql9 naoYIqlb/oRN29LUF1djoIWMIqTKTd6aCKr8f0gBFl0XvDxf+RumUKs/XgvvvcmkMa3d6do2t8/ IzGbHCKiwXyWXkJgv6XoBilvTNX2YGLjoAmUC0xmt+lAvQqaiks6G8DxZvT+MvYj2MZAFyXeIVx E6S6sagOrk8il3SxxOkOo/Xg6a4X5pWaF53h80sbut2DWcvkX17Jr24qeaB747oTwO7qRD2n90h xSyFBV++jv18cSQq6k8Ao9FoIRaPQKLSsGaVD7lZAqPPQbtLu/KSA X-Google-Smtp-Source: AGHT+IEBRl2s1NJsrrS4RLEY70U/zyBuVwfFp/WJwDhPrzRXk2VUebd2tIdOlDbR+xmmJzHeIjDfLw== X-Received: by 2002:a92:cd8a:0:b0:3dc:7fa4:834 with SMTP id e9e14a558f8ab-3ddce448577mr39474515ab.15.1749223598285; Fri, 06 Jun 2025 08:26: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-500df586fa0sm480689173.75.2025.06.06.08.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jun 2025 08:26:37 -0700 (PDT) Date: Fri, 6 Jun 2025 10:26: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 04:26:56PM +0200, Christoph Berg wrote: > Re: Fujii Masao >> Some users might want to trigger a spread checkpoint but not wait for >> it to finish, since it could take a long time? If that's a valid use case, >> maybe we should add a WAIT option to let users choose whether to wait for >> the checkpoint to complete or not? > > Do we want that? The checkpoint is only effective when it's finished, > and running `psql -c "checkpoint (wait false)"` might make people > shoot themselves into the foot. *shrug* I imagine the documentation will pretty clearly indicate that setting WAIT to "false" will cause CHECKPOINT to not wait for it to finish. > + MODE > + > + > + The CHECKPOINT command forces an immediate > + checkpoint by default when the command is issued, without waiting for a > + regular checkpoint scheduled by the system. FAST is a > + synonym for IMMEDIATE. > + > + > + A SPREAD checkpoint will instead spread out the write load > + as determined by the > + setting, like the system-scheduled checkpoints. > + > + > + I don't understand why we need to add both FAST and IMMEDIATE. > + > + FLUSH_ALL > + > + > + Requests the checkpoint to also flush data of UNLOGGED > + relations. Defaults to off. > + > + > + Could we rename this to something like FLUSH_UNLOGGED or INCLUDE_UNLOGGED? IMHO that's more descriptive. 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. 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). -- nathan