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 1tmUme-0076qh-61 for pgsql-admin@arkaria.postgresql.org; Mon, 24 Feb 2025 09:29:52 +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 1tmUmd-0004L7-9x for pgsql-admin@arkaria.postgresql.org; Mon, 24 Feb 2025 09:29:51 +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 1tmUmc-0004K3-TJ for pgsql-admin@lists.postgresql.org; Mon, 24 Feb 2025 09:29:50 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tmUmZ-000Ruw-2U for pgsql-admin@lists.postgresql.org; Mon, 24 Feb 2025 09:29:49 +0000 Received: from [192.168.1.131] (35.108.220.81.rev.sfr.net [81.220.108.35]) by mail.dalibo.com (Postfix) with ESMTPSA id 915F726178 for ; Mon, 24 Feb 2025 10:29:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1740389385; bh=UdrGgO1Gs+hbmECWa52RtWpl4jGgquFoZPSr+kH8DTU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=O4TAb54f91bMcMb9L3+yHfMq9kZeDQ3vJEWIlKZ7m18PqqzG8DmFtvG/Tj4r9dIVQ 9l4rdNZq0vtuVa3vLX31Isf8E5KDfziYr6x29Igsemfm8VsBjHLvRac/dNcXNTPNsS NEc5bRAYXSauaLXaw3yTQMZv3gDTsB/Ad63rnlsE= Message-ID: <559a5bad-3ba9-406d-af78-c28429037245@dalibo.com> Date: Mon, 24 Feb 2025 10:29:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Question about pg_dump + pg_restore + pg_toast To: pgsql-admin@lists.postgresql.org References: Content-Language: fr From: Guillaume Lelarge Organization: Dalibo In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 24/02/2025 10:19, Edwin UY wrote: > Hi, > > Checking one of the databases, we have the schema below with size as > below. I just rename it as abc, this is the one we want to dump and restore. > >     schema_name     | schema_size > --------------------+------------- >  public             | 656 kB >  pg_catalog         | 6608 kB >  pg_toast           | 412 GB >  information_schema | 104 kB >  abc                | 187 GB > > We are upgrading this database from v12 to v16 and we want to do a dump > of it in case we decided to do a restore from v16 to v12. > SO, after the upgrade, in case we want to rollback to v12, we will do a > pg_dump using v16 and then using v12 pg_restore > When we do the dump, does it take into consideration the size of > pg_toast as well? So it will be 412+187-GB :( ? > Yes. They are part of the tables, so, sure, they will be dumped (at least for those in the "abc" schema). > BTW, was pg_toast created automatically by PostgreSQL? Reading on > https://www.postgresql.org/docs/current/storage-toast.html www.postgresql.org/docs/current/storage-toast.html>, there is no mention > of it. > Yes, it is automatically added when a user creates a database. Regards. -- Guillaume Lelarge Consultant https://dalibo.com