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 1sXSi6-004A8n-AE for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jul 2024 21:42:46 +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 1sXSi3-000URR-R0 for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jul 2024 21:42:43 +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 1sXSi3-000URH-Bx for pgsql-hackers@lists.postgresql.org; Fri, 26 Jul 2024 21:42:43 +0000 Received: from mail-yb1-xb2f.google.com ([2607:f8b0:4864:20::b2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sXShw-001cNw-L3 for pgsql-hackers@postgresql.org; Fri, 26 Jul 2024 21:42:41 +0000 Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-e02c4983bfaso129189276.2 for ; Fri, 26 Jul 2024 14:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722030156; x=1722634956; 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=D37ImeUP7Pt0YFcAkUMyJZa8VubnpPYPvbStG5lnm0g=; b=csHRW8hEcchFxiyG2m9XWkOLJG71EXRzz75z1yl9o5Cb/5fxaOlUSrkDcGXLYjZSXC +pDUDHptn/SCyr+v00TyC2Tex8TY/JN0/BH3lLj5xDkPaG2/ck6g0j39uPYf9GZRHqS+ Lh3hcnH9JS9yLJMk97MpI/nCJhh2ezZs6UKgjMiOiLbtJMAxxDQ6lmp8Lyv6nXqnjZFP CoNxdmVQHc3wMYFPKFoPpU3RHJqAhLd91oS1umupkoiV6vH5IKIOUSlUTVaPJTFf5/2c NXCAzWUgUMGn50CLN6N720lq4+G6XhFZ8pnirltrc1fIzeFDFyclame7uYvXB3+LEZ1q 9FPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722030156; x=1722634956; 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=D37ImeUP7Pt0YFcAkUMyJZa8VubnpPYPvbStG5lnm0g=; b=HXe+/qg8wklMxNSEVNFE5GQr6tzgfOFIlziR8NegbfK/ZfUJlwTKIxAgA6cFLwioju pvnsruaBsisuyFePh7sfBQ1y5Ey3H+GxNxIGJ7M9z4wOHxW+rwkXtMSRl7vzEtT91Nqe tafarhIO8R9Gbt8GL7gGUul3GMOdd+IjBrtzoqkXgpd6fHOXgVsAR8Dg4euWnlqIs5x7 nZybLqU2R9UxCDImklkG72T3sipChdp6WLVpHeviCyJWKgwcSHVwH/kJdX1wW6AgonJP lXvh+IHSAReIRYwTU3qV2Jeu2JPUxWDCX7qx21l3lbBBvUyCQlNjE3i/KRIpAvZIqpG+ pqwA== X-Forwarded-Encrypted: i=1; AJvYcCUG8VX8THnk+TlbOyMxF7doL/XMW2GlLckkoJpPoeGqCP7GFoCBC3EHnOGEGi2D+M7SmGrtfkcp2yttlrVCxvve2M4r4t6VMsd1GFjm X-Gm-Message-State: AOJu0YydBJGLctx5zUtD1/VhtgStT9dpCCEoHR478d/CB6HoNbaNeDpc nHKZntBNj+Mjt3nt1EfkMIh3gnRyoWKvzBa2LNceop6hRWvesjjF2A5Tt44oLQ5tcRDcwSWhS5d bi+Jjv8DhoqPNp7wKRgAuuW31hmA= X-Google-Smtp-Source: AGHT+IFnse08K5vIkte5mzY+9JI8fvc8uYC6A7/tumfL3VaN2RTjWe7yepm2H9iugRc4dZ5249ImD0yYju2sYZA+TvM= X-Received: by 2002:a05:6902:1449:b0:e02:b60c:3d2 with SMTP id 3f1490d57ef6-e0b545f8a2amr1240899276.50.1722030155737; Fri, 26 Jul 2024 14:42:35 -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> In-Reply-To: From: Alexander Korotkov Date: Sat, 27 Jul 2024 00:42:23 +0300 Message-ID: Subject: Re: pg_upgrade failing for 200+ million Large Objects To: Justin Pryzby Cc: Tom Lane , 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 Fri, Jul 26, 2024 at 11:36=E2=80=AFPM Justin Pryzby wrote: > On Wed, Jul 24, 2024 at 09:17:51AM -0500, Justin Pryzby wrote: > > With partitioning, we have a lot of tables, some of them wide (126 > > partitioned tables, 8942 childs, total 1019315 columns). > > On Fri, Jul 26, 2024 at 10:53:30PM +0300, Alexander Korotkov wrote: > > It would be nice to identify such cases and check which memory contexts= are > > growing and why. > > I reproduced the problem with this schema: > > SELECT format('CREATE TABLE p(i int, %s) PARTITION BY RANGE(i)', array_to= _string(a, ', ')) FROM (SELECT array_agg(format('i%s int', i))a FROM genera= te_series(1,999)i); > SELECT format('CREATE TABLE t%s PARTITION OF p FOR VALUES FROM (%s)TO(%s)= ', i,i,i+1) FROM generate_series(1,999)i; > > This used over 4 GB of RAM. > 3114201 pryzbyj 20 0 5924520 4.2g 32476 T 0.0 53.8 0:27.35 po= stgres: pryzbyj postgres [local] UPDATE > > The large context is: > 2024-07-26 15:22:19.280 CDT [3114201] LOG: level: 1; CacheMemoryContext:= 5211209088 total in 50067 blocks; 420688 free (14 chunks); 5210788400 used > > Note that there seemed to be no issue when I created 999 tables without > partitioning: > > SELECT format('CREATE TABLE t%s(LIKE p)', i,i,i+1) FROM generate_series(1= ,999)i; Thank you! That was quick. I'm looking into this. ------ Regards, Alexander Korotkov Supabase