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 1tQrr0-005glu-5W for pgsql-general@arkaria.postgresql.org; Thu, 26 Dec 2024 17:40:58 +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 1tQrqy-003dSi-RI for pgsql-general@arkaria.postgresql.org; Thu, 26 Dec 2024 17:40:56 +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 1tQrqy-003dSa-C5 for pgsql-general@lists.postgresql.org; Thu, 26 Dec 2024 17:40:56 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tQrqw-000gEA-2T for pgsql-general@lists.postgresql.org; Thu, 26 Dec 2024 17:40:55 +0000 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3eb8559b6b0so3479686b6e.1 for ; Thu, 26 Dec 2024 09:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735234854; x=1735839654; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=2WvosW6QJc8eJNcQG7l+RRgNBdmCJwQjhbeLndtxJjg=; b=L5m/IqAnt7N0UDHWEK99FCfU4kPsSzQqnj4em8M9hGjLkjWsr+GmYbpMNuRow4QS7Z yZxsdzeIdT57sVTLUM3R0wqdzObtnM3Nvr1n2OI7b27D5l0GQzi1tf/x/j3oJhyuHGip R9DzK65SJrzhg9chItGmzJq14FwaujB5K964BRk/4SiPFVGHsFhI4SDyLe6LirOmGGyA QU2hrFMRJ5kFYRbDL5KNNgRy8Wwr7tikG+x3HsdzXH0C+Jza+4ySfNrKrwpcQ714Q4hw bOzch7ODyYUxO79nL3N+r2kZmjFNJ3jEGPt5zQrQ9nB+ZrMBhfhBMOIblnPNyEtAwNEI Helg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735234854; x=1735839654; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2WvosW6QJc8eJNcQG7l+RRgNBdmCJwQjhbeLndtxJjg=; b=Jbn54HKq+30KboFBtKsMhqMFEsp6IKmWO2G9+Nu/0wOxnQGLzVCqHqd1p4EQetGFM0 1N/QA2E236EaES4zZ6HO/pEGDZ7SoIQtb7WGk+7WYLchwgRuXx5oPCfQ4rSnG1xqm5ih WwQIocH9jobQglcbXuYW6WorOFpx30PAA7MnqzwG0SdiJ8lqfgM97tKKZJAwh7Kd6d4F fJdJ8zLx2nGRIhsopsb1wWOAljzqAghttCrpBDMu2jcDFGEv2FCFvvjj1GiNFdr5r/z5 wlgP10Dp+QCXBKTvaWap1QO+fTd/IFKOCPDH4ViHYpmv/S+Wq3EBZ60AFMvQu/z+xkan hyRg== X-Gm-Message-State: AOJu0YzYahspERU6x90ETr1/Qun/ESPdYdE8nIBnEO3sv6PjTDyXi7CC LJKFMLKe9iGI2bAlfyLfYenY/6RUhK3YohuAhIGV8FokLbQJvOCXV4tRPvibQCqiqx4BH9vgQF+ I9Fvy7n2eopZSxo5zw8zDLLnPPqxwA4NylZ4= X-Gm-Gg: ASbGncssPRWQ1AxIIdqGNildYuxCdDHU9PEP9Pd3H3f56KcnB2qiGfJ+D5R1D3515P4 dybp7syzWC75q+8Gm8rh4ARwyH2/89ZyzG2/yu9ksJxCewXedqt88hg== X-Google-Smtp-Source: AGHT+IETSZ5s3LtlzBqkvRjeCiWMRcArqBcpOe6FGlJB1zQjUMPi9uTCn56upwm+xnHWCXEwrVDpGJKwE7rnxgVuStQ= X-Received: by 2002:a05:6870:ff94:b0:29e:1325:760a with SMTP id 586e51a60fabf-2a7fb01747emr12925636fac.8.1735234853953; Thu, 26 Dec 2024 09:40:53 -0800 (PST) MIME-Version: 1.0 From: PetSerAl Date: Thu, 26 Dec 2024 20:40:44 +0300 Message-ID: Subject: Synchronous commit after asynchronous commit To: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --setup create table a(i int); create table b(i int); insert into a values (1); insert into b values (1); -- case 1 set synchronous_commit = off; begin read write; update a set i = i + 1; commit; set synchronous_commit = on; begin read write; update b set i = i + 1; commit; -- case 2 set synchronous_commit = off; begin read write; update a set i = i + 1; commit; set synchronous_commit = on; begin read only; select i from a; commit; -- case 3 set synchronous_commit = off; begin read write; update a set i = i + 1; commit; set synchronous_commit = on; begin read only; select i from b; commit; -- case 4 set synchronous_commit = off; begin read write; update a set i = i + 1; commit; set synchronous_commit = on; begin read only; commit; As I understand documentation, case 1 is clear: following synchronous commit of read write transaction force previous asynchronous commits to be flushed with it. But what about case 2 (read changes from asynchronous commit), case 3 (read unrelated data) and case 4 (empty commit)? Would synchronous commit of read only transaction force previous asynchronous commits to be flushed to disk?