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 1sA2jM-007A7H-MB for pgsql-general@arkaria.postgresql.org; Thu, 23 May 2024 07:19:18 +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 1sA2jM-009H7W-Ak for pgsql-general@arkaria.postgresql.org; Thu, 23 May 2024 07:19:16 +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 1sA2jL-009H7F-TX for pgsql-general@lists.postgresql.org; Thu, 23 May 2024 07:19:15 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sA2jI-001aCg-Mq for pgsql-general@lists.postgresql.org; Thu, 23 May 2024 07:19:14 +0000 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6a077a861e7so41829026d6.2 for ; Thu, 23 May 2024 00:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716448751; x=1717053551; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QBrjnaO5ZlQr4mRq+T2l9aBh24snClhmXKl+BPUuCNw=; b=QdmzI1Rlmere1CcXszyxrRNetfRiWft0bFaZlU2o3r49riDtKx7wQLvZAyA1f6Rm0w qBDfBZZWekuWq9zYhRmmdpAJ0LEYbOkwcun2wFTzFNxk1pvWyJjyRRX+jD4Z7OiUhxSj goViMKhhwiq+JZiZZ/UGtiZggNQekjDDsMU+YYuH3QPUe9XUPOa6Mat5bAjgvySOjOba lQgxnKf3mSwQY46Ys4gZ+g0WBo4/+d/tEOxEOYO4PRzyoR3iUvgf/OTsvMhvYI/5D1xD Pwar7LbqMotkdo3SFLK9/Y7viOhoPSnHdhJNh7PDsCRzSpNbActbdVWpXAOrK/CUplG9 fpKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716448751; x=1717053551; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QBrjnaO5ZlQr4mRq+T2l9aBh24snClhmXKl+BPUuCNw=; b=rfmilbKtLXehzlJzVa3QOIsofrXjveXYodii0LGkR1NB66fbSPIf8VhdMk2N1i6a8V TW7/lnORgoirW08AfO6FPSrfu5YZ6sg4WT8r69Ti1OPcRQQ7GVZbAcUn2n8hggBxwNFl Dba5hEO1UJnC32rMgDxHOrXmAqFvAuIXyYKzgNrPG85Hfb68VgQcxHvikAw4pPJgXy6O rjov0JlpB3Th1hC8QTvx03YYKsqVsYXVw8G2MPMBkXnGuIs4agaxOejqDXd5KH5dTw0c Oh6xS3A648W9F3ajcJ0QfJVsKVYwL63CQR8inkNJE1VxxiGunUxtCFTAwoekIHQD2Zuk q++w== X-Forwarded-Encrypted: i=1; AJvYcCXQAhzitxLPAuocmGWG2LgtpZJP1RK2TgZ5F4cv2tC7ryoFhHrrnUNR6Xz4zv+pCUXTuBW5u7TB4+xrR6YsHmxrQqo4KPV+lXg8AJtGOHICjAIW X-Gm-Message-State: AOJu0YwR37YEHT+KwPvT4mZubIhIxWkL0QixOXWDcu2GJVWlvGxz9d0U f3Xmvfs0jJU2DCMiKpIE9ljEdljfz6mmYAY0Ar3LpG4BwI1vz4snOXGaq3N5U9s4Y86inM/Fo2Y wkTvVW9UHFPzkbk4ikgiKArBxAPs= X-Google-Smtp-Source: AGHT+IFzRgl+cTCil3QRWrGMzXP6IBiEmczi14u/B/MyCCzzphaRUEUz/nvzbfN4t4pnDMbpS7o1brZuERsPFo5ZGRA= X-Received: by 2002:a05:6214:2e46:b0:6a0:c339:1ede with SMTP id 6a1803df08f44-6ab80901482mr50795696d6.40.1716448751474; Thu, 23 May 2024 00:19:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: yudhi s Date: Thu, 23 May 2024 12:49:00 +0530 Message-ID: Subject: Re: Long running query causing XID limit breach To: sud Cc: Muhammad Salahuddin Manzoor , pgsql-general Content-Type: multipart/alternative; boundary="0000000000001b5e9b061919dead" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001b5e9b061919dead Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 23, 2024 at 11:42=E2=80=AFAM sud wrote: > >> Calculation Rationale >> Daily XID Usage: Approximately 4 billion rows per day implies high XID >> consumption. >> Buffer Time: At 1 billion XIDs, you would still have 1 billion XIDs >> remaining, giving you roughly 12 hours to address the issue if your syst= em >> consumes 200 million XIDs per hour. >> >> >> > > OP mentioned that initially the number of business transactions is around 500million but the rows inserted across many tables are ~4-5billion in total per day. So doesn't it mean that the XID consumption will happen based on the transactions rather on the number of rows basis. Say for example ~4billion rows may be loaded using a batch size of ~1000 using bulk load, so that will be ~4million txn so it should use ~4million XID but not 4 billion XID usage. And thus making the transactions process in batches rather than row by row minimizes the XID usage. Correct? --0000000000001b5e9b061919dead Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Thu, May 23, 2024 at 11:42=E2=80=AFAM = sud <suds1434@gmail.com> wr= ote:

Calculation Rationale
Daily XID Usage:= Approximately 4 billion rows per day implies high XID consumption.
Buff= er Time: At 1 billion XIDs, you would still have 1 billion XIDs remaining, = giving you roughly 12 hours to address the issue if your system consumes 20= 0 million XIDs per hour.


<= br>

OP mentioned that ini= tially the number of business transactions is around 500million but the row= s inserted across many tables are ~4-5billion in total per day. So doesn= 9;t it mean that the XID consumption will happen based on the transactions = rather on the number of rows basis. Say for=C2=A0example=C2=A0~4billion row= s may be loaded using a batch size of ~1000 using bulk load, so that will b= e ~4million txn so it should use ~4million XID but not 4 billion XID usage.= And thus making the transactions process in batches rather than row by row= minimizes the XID usage. Correct?=C2=A0
--0000000000001b5e9b061919dead--