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 1sXXgE-004ikF-QF for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Jul 2024 03:01:10 +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 1sXXgC-00276g-Bd for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Jul 2024 03:01:08 +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 1sXXgC-00276Y-1k for pgsql-hackers@lists.postgresql.org; Sat, 27 Jul 2024 03:01:08 +0000 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sXXg5-001g6T-6f for pgsql-hackers@postgresql.org; Sat, 27 Jul 2024 03:01:07 +0000 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-e08a538bf7bso210337276.1 for ; Fri, 26 Jul 2024 20:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722049259; x=1722654059; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6Oq9GeWGCjsYyCXzzcF0JuJzJZ0Kvo9AFKPK4ttKuDU=; b=WKHuE0H4Dspart7pAI++qFF9Qt6aWi8Y7CzeCAWnuObZT388zI54lCyzNuz3E/alpv g2wCkzaeG+txGhRYOiBACtq2l+7yNS9KORp5nr81zO0dqoQ9ZZ738AeGil3LBpXWKxJR jEzwsoo+sb6zDzZR9gJQ9nmbWCaCgI/WHnhB9tVcoFk2/uFJrWUtIFR98chUBVAg120X KdZaieSzzSzv5MN7ml0uKhcHJNDiQxhpw3RLROBC4UGsSUfKLzbJEf+8XaBsC75QjgUP 2TrH/+IcLdeVDVOPs29UA+5kD7fHwRLoMKhqOGqkzdfmXVEp9kRCYapdeuwFtfZo8wWd 5TbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722049259; x=1722654059; h=content-transfer-encoding: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=6Oq9GeWGCjsYyCXzzcF0JuJzJZ0Kvo9AFKPK4ttKuDU=; b=rmBDTQvk+pNywck2DxPqk42nYp4XGAPfcMTkKLesHZlqFZO+BUrPJpO/MdP8RLUOoN ISp21gxQLl9+G2jXoGxw2aMSa8dT+q1qTP6lxF+3n5u+md31DgNbbXAwGEsL3GsRPbJU 206TLXSe1CnnBEM0EHdYpgL3GCXWNLlvymIhTskZo20Q965Z1ez8jTbMu68HPnAg9N/O DheHwEjeenDHKhSc69PidsIhFS+uveXg1sgwUgOwUOVbQPyi7dGheQGtvz5yaA3MOZL/ iBjwc9oP1gvL/TGo7OhSLYgIlc5CV8yhefGEgHHIqcGfl06vGSsKHzxOzZ34jG2r97xv XGLA== X-Forwarded-Encrypted: i=1; AJvYcCUZQ2jYrry7iwY7JrqCZOWYPYvKndMNFashXUnm/imGBH6eWhr7osJCwgu7OLkKqGFCZgRNsbuh++u6nnxGzZWk/IX0+8zJFojSDvNN X-Gm-Message-State: AOJu0YzfmaxiOlYh93QzyR6YZaw94fxjiLi/ssJOPsxfUZIH/VxFe1F7 peHcJc1P/zmeE0/GNgIEMLcn0iY8b0CqhnehRHZA99iZDVTKglL9objMP6KyXAJrSKgJHGA9zuu g3txTB7NX4co9K8y29KdUT/Z1n08= X-Google-Smtp-Source: AGHT+IFBPI8DW7YJe8Sn4WfEWxUCQJFvOIcU4njjPsMaooViPcCLwA+h91q0V7j3+rCozDx7xW4axBmCqCDcoMsQnGI= X-Received: by 2002:a05:6902:70a:b0:e02:c458:c70f with SMTP id 3f1490d57ef6-e0b5593be01mr1611152276.22.1722049259465; Fri, 26 Jul 2024 20:00:59 -0700 (PDT) MIME-Version: 1.0 References: <4a3ebf7d81bfc6dd4d545e5b27d6e8f6c32d8937.camel@cybertec.at> <3023817.1710629175@sss.pgh.pa.us> <6603e4e0.500a0220.a557f.4f39@mx.google.com> <3304322.1711551245@sss.pgh.pa.us> <20240327150826.GB3994937@nathanxps13> <20240401191930.GA2302032@nathanxps13> <1217588.1711999706@sss.pgh.pa.us> <1870579.1722033430@sss.pgh.pa.us> <1873872.1722035181@sss.pgh.pa.us> In-Reply-To: <1873872.1722035181@sss.pgh.pa.us> From: Alexander Korotkov Date: Sat, 27 Jul 2024 06:00:47 +0300 Message-ID: Subject: Re: pg_upgrade failing for 200+ million Large Objects To: Tom Lane Cc: Justin Pryzby , Nathan Bossart , Michael Banck , Laurenz Albe , vignesh C , "Kumar, Sachin" , Robins Tharakan , Jan Wieck , Bruce Momjian , Andrew Dunstan , Magnus Hagander , Peter Eisentraut , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jul 27, 2024 at 2:06=E2=80=AFAM Tom Lane wrote: > Alexander Korotkov writes: > > On Sat, Jul 27, 2024 at 1:37=E2=80=AFAM Tom Lane wr= ote: > >> It's fairly easy to fix things so that this example doesn't cause > >> that to happen: we just need to issue these updates as one command > >> not N commands per table. > > > I was thinking about counting actual number of queries, not TOC > > entries for transaction number as a more universal solution. But that > > would require usage of psql_scan() or writing simpler alternative for > > this particular purpose. That looks quite annoying. What do you > > think? > > The assumption underlying what we're doing now is that the number > of SQL commands per TOC entry is limited. I'd prefer to fix the > code so that that assumption is correct, at least in normal cases. > I confess I'd not looked closely enough at the binary-upgrade support > code to realize it wasn't correct already :-(. If we go that way, > we can fix this while also making pg_upgrade faster rather than > slower. I also expect that it'll be a lot simpler than putting > a full SQL parser in pg_restore. I'm good with that as soon as we're not going to meet many cases of high number SQL commands per TOC entry. J4F, I have an idea to count number of ';' sings and use it for transaction size counter, since it is as upper bound estimate of number of SQL commands :-) ------ Regards, Alexander Korotkov Supabase