Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnxEW-00046j-Vt for pgsql-general@arkaria.postgresql.org; Mon, 09 May 2022 06:51:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nnxEV-0003iz-0k for pgsql-general@arkaria.postgresql.org; Mon, 09 May 2022 06:51:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnxEU-0003hL-IL for pgsql-general@lists.postgresql.org; Mon, 09 May 2022 06:51:02 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nnxES-0005os-6G for pgsql-general@lists.postgresql.org; Mon, 09 May 2022 06:51:01 +0000 Received: by mail-ej1-x636.google.com with SMTP id l18so24843768ejc.7 for ; Sun, 08 May 2022 23:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=3ru5YhjlRvJXeunEddbCqzyOAlZ0cTClSIFsOW4zq5A=; b=do8fICbBLAJDC0OBr2Bhetr3zl144zsYOT/A1MVuJnsmSN42zE630IfG7O3+wPuzcU j89dbo+vbAVDVx2tCENCiuSNratPf+3k41oMmh/Tzbx+uDrgZDhT0bcn6xPe0e1cjU9i 9au+umQIjTpTytco91CPG7usfUhxBORoXjoHfe0D09rajK+Th3286n1aPAlsOd8eTjJc iiQKInPFlMznMXH9eVTonHERHN6Cm1/w+yXAbSWCpZxjw2naXUziEPD1zwCHjiKwDW2v FZgnvaEFFjt5/Rsstr9sCcSdXwFg9dpkYYtnb27MFvkKoGPlNmEL1StRz5RvhX/W/Pwu BEnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=3ru5YhjlRvJXeunEddbCqzyOAlZ0cTClSIFsOW4zq5A=; b=6bJoi6CkIGxy0UyW8T2nLKT8mQT8bDYVuD0Ghz9hyNhZl0OMnZuqIcOITfCSRVYpwy VKRzYpZ29wg0g08MPhMM5uLFEH/Igw3rm3lSenVHPEr1c4YnVgBwmWv4yuOCghchMxyR ltncMH2S06Gr2VKcE3uSmm0gELC+K2y3K3Ga0YVjrvze0fTsiTNr9LZxxRgThn/HEpvF O4RXcKAw5IyGElUvRgIeTsiFgy/35CWGzS/VvzFaI0I2Y/nR2WwGd9NVC3jkhjr8pIP6 Gsj9avk0eNnUDIcpuKuu93xnFIp5u9S6HR7aC0zurrsQEra4+/c3KIDonx5IhSvTIous LQaA== X-Gm-Message-State: AOAM532tVngupCovC3SblwFdIuavYk3+4kSky9xnCQmomw8s+kk1KQ5/ AQvMvBKyk0GrtrgIQTHy4mViKw== X-Google-Smtp-Source: ABdhPJwOzmp9dO6sIBMsY7giz/8ESLwDsU5R+vFrL21WuqEM1AAWg82R7wAkzZqjn5fvcAbDjmbpwg== X-Received: by 2002:a17:906:2652:b0:6f3:a042:6b51 with SMTP id i18-20020a170906265200b006f3a0426b51mr13165853ejc.565.1652079057596; Sun, 08 May 2022 23:50:57 -0700 (PDT) Received: from dynamic-pd01.res.v6.highway.a1.net ([2001:871:5e:d0a8:787a:f817:ee93:3128]) by smtp.gmail.com with ESMTPSA id u9-20020a05640207c900b0042617ba637bsm5919564edy.5.2022.05.08.23.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:50:57 -0700 (PDT) Message-ID: <90e562bcf112ba3adacf1c39a160d3680d3b714d.camel@cybertec.at> Subject: Re: pg_dump: VACUUM and REINDEXING From: Laurenz Albe To: Guillaume Lelarge , Ron Cc: "pgsql-generallists.postgresql.org" Date: Mon, 09 May 2022 08:50:56 +0200 In-Reply-To: References: <3336352b-f97a-86e3-585b-207a98f56d4d@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 2022-05-07 at 12:06 +0200, Guillaume Lelarge wrote: > Le sam. 7 mai 2022 à 10:21, Ron a écrit : > >  On 5/6/22 21:35, Hasan Marzooq wrote: > > > I've some questions around Backup & Restore. > > > > > >  1: Is it necessary to perform a VACUUM and REINDEXING operation after restoring the > > > dump from Postgres 9.6 to Postgres 13? The dump size could be 1/2 TB to 1 TB. > > > > Perform VACUUM after there have been many updates and deletes.  There have been zero > > updates and deleted after pg_restore; therefore, no need to vacuum. > > I disagree. You're right about the "zero updates and deletes", so no need to vacuum for bloat. > But you need vacuum to get the visibility map of each relation, so that the planner can use index-only scans. But from PostgreSQL v13 on, autovacuum is also triggered by INSERTs. So I'd say that there is nothing to do after restoring a pg_dump, except to wait until autovacuum is done. Yours, Laurenz Albe