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 1syQMJ-00GhQb-7p for pgsql-general@arkaria.postgresql.org; Wed, 09 Oct 2024 06:39:43 +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 1syQMG-00EdUk-RS for pgsql-general@arkaria.postgresql.org; Wed, 09 Oct 2024 06:39:40 +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 1syQMG-00EdUb-Fi for pgsql-general@lists.postgresql.org; Wed, 09 Oct 2024 06:39:40 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1syQMD-003GWG-MO for pgsql-general@lists.postgresql.org; Wed, 09 Oct 2024 06:39:39 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5c42e7adbddso8565504a12.2 for ; Tue, 08 Oct 2024 23:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; t=1728455976; x=1729060776; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=QaVnI0TOJlsjnBWYsV+HdFshn9wXQgLomLBjVs+rxu4=; b=EH4Ytsw/U8z3uggfCecxHulGFHXVtz9U3JsW+SvExcRB8hIS29zlFXUPdjfI36cC9a +d/X4AivWy7u9L1OJ5+RGO/Krhv2mDZ3RPx8nLjogjSE6ahcs0kkSkBCFzh1/g8Xx4mH w031Dp2oEBP4eWoJ9WArLi4GUzmWasX7JGrug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728455976; x=1729060776; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QaVnI0TOJlsjnBWYsV+HdFshn9wXQgLomLBjVs+rxu4=; b=EyyH6DJwJhN0+Ag2SBTHCUEvqxmkLTrg8trihhROgbL6iIK7oCWRjXqFLG7N4q/riK 6ImI3KaAC5DGBa50RpLXGfOYaCPmj1X1rmGhlSgqwOEKH3LgGV48wPcDdR6iZaePCA6s Y3rkX8yHQwPHB5uL41cdgBCxLCj86SJSIaJb2kXxM7MZRZZSdB0Xps1z/94LrnAUqQiY jAp/pD1hWbH/S7NsjRdauOTLtJVxy6VBoUIOIaz/hxV7F9rgNndziGe8UjXdoC7qaEEK D2Agy3a1wooT2zdyy/AikuBkTFo4t7OfRwUyY0Undd4JvPmuIBzUSyD13BaPfm3ejhwe N1og== X-Forwarded-Encrypted: i=1; AJvYcCXCnVoMav0mDk2pidBN1ATjuK1XdlnTTT8Ur1mjVVHM/7QjPpzOvd1VMPQeoqgF86DgVwgeLFFxMtCIX9Ma@lists.postgresql.org X-Gm-Message-State: AOJu0Yy7FWRlS0jBTWymPtXh3npkjHL1EW42QQF7VM/+JlMJ7KlYUZRu +tMgbc1DITpV8QRLTpSG5Z9TnW0fLW+c5i+X5GJgQT+lOecF1GZX+UbyR3ywyns= X-Google-Smtp-Source: AGHT+IGfjtBkgoqOOE9EPbh8Yy9Y5TGxMY1d5pfJu/8PaME2W2KtpweaIlxkNcspN30ic4XbCoFn4g== X-Received: by 2002:a05:6402:3582:b0:5c8:bb09:b417 with SMTP id 4fb4d7f45d1cf-5c91d4062bbmr1022722a12.0.1728455975988; Tue, 08 Oct 2024 23:39:35 -0700 (PDT) Received: from dynamic-pd01.res.v6.highway.a1.net ([2001:871:5e:1fe8:e413:9350:951c:da89]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c91d0be1fbsm540624a12.3.2024.10.08.23.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 23:39:35 -0700 (PDT) Message-ID: Subject: Re: txid_current vs xact_commit stats From: Laurenz Albe To: senor , "pgsql-general@lists.postgresql.org" Date: Wed, 09 Oct 2024 08:39:35 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-1.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2024-10-09 at 04:22 +0000, senor wrote: > I was under the impression that all transactions must end with a commit o= r a > rollback but watching stats doesn't support this. Web searches tend to re= turn > info on what a transaction is or the ratio of commits to rollbacks. I fou= nd > nothing contradicting what I think I know. The rollback can be implicit, for example when you terminate the connection= or crash the server... Also, PostgreSQL has autocommit, so every data modifying statement that's n= ot in an explicit transaction will implicitly commit at the end of the stateme= nt. > I've sampled pg_stat_database.xact_commit, pg_stat_database.xact_rollback= and > txid_current() at intervals on a few independent clusters and see that co= mmits > increase anywhere from 50% to 300% of the rate of transaction increase. R= ollback > remains very near zero for all clusters. Each cluster tends to stay consi= stently > within a range (i.e. 120-130% or 50-70%). Perhaps what I wrote above explains that. > PG version 11 & 12 on Linux That's too old. Yours, Laurenz Albe