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 1sh9rc-00Dibo-EK for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2024 15:36:40 +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 1sh9ra-003RmF-63 for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2024 15:36:38 +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 1sh9rZ-003Rle-9f for pgsql-general@lists.postgresql.org; Thu, 22 Aug 2024 15:36:38 +0000 Received: from fout4-smtp.messagingengine.com ([103.168.172.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sh9rX-000v6k-2v for pgsql-general@lists.postgresql.org; Thu, 22 Aug 2024 15:36:36 +0000 Received: from phl-compute-01.internal (phl-compute-01.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 035CE138FF6F; Thu, 22 Aug 2024 11:36:34 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Thu, 22 Aug 2024 11:36:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1724340993; x=1724427393; bh=CLcdqEzf7zEXjKMczhzAWYPC8bXIB9E1hwYG1KdOlV0=; b= 0iZWYUOQ0G8ehyIv3LH49mTGWE1NNBoqs/iLSNBlxa5ygWARNNJAg+wPz5qYiOzX VsI3BizDo1ydQX7h92NuwkEcF8EdqtXsSaQUMhiQLVI3Wmt7YIg7pYHqJ3qUGh9L mN0EAYwiJKbBGTec9pBaofFhMc9SilDw5kbiXzGyyVRhV4Ckv2wJiAmBfwquQvUO JgvRVLuERJR1L3Jzuqt7zjK3UcGlMdVyarChOsQd9FS9hlJhqOcbVWsVS4xCPwxO 5Ii/g0GP4owfB+ZdC+zISFK/eSGqZhuTY0hX+mUn6RYbjItRSpcpdZU9/BMBDqPU xzQVQ/+f06v4Uw5QX7O+GA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1724340993; x= 1724427393; bh=CLcdqEzf7zEXjKMczhzAWYPC8bXIB9E1hwYG1KdOlV0=; b=p /Ps6lUH6apidjiAS6A+t6Jagkv8pdzqk9HXlU84YpEjjjq+2z10TEh/GUWB+z9EJ xTfJ60ZJPmrnkrMT9KPKeWdnM1lxGTyfHXdaFj3RR1xCc6nfY+Ea8cxoWfJKUSMB vHaw8gLavJmAQSrnfmPu7edVfTJmmtMDeSWlOINA/FbbYn9NSY26ndqmTmkuaSUj 9QC3yf/i8wxTKmlv7WLYwUy53fhcv9SYIfq+S6CbbKd6R2Tl9KQoQO9BOJASIH9Y Cw1MNaWUbVngUmEfAJiKxYugHzMN1GwFer54nL4oiC3zvxlIvMF+P4jaaTqAg+tv ZYdt883TIsoDQwq7QIUXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvtddgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeen ucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeeivdfhieehheegueeileej ieettdejhedugeefleekvdelkeehtdfgiefffeekudenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehsihhpphhinhhgohhnvghsrghnugiivghrohhssehgmhgrihhlrdgtohhm pdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvg hsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Aug 2024 11:36:33 -0400 (EDT) Message-ID: Date: Thu, 22 Aug 2024 08:36:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How to validate restore of backup? To: Vince McMahon , "pgsql-generallists.postgresql.org" References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/22/24 04:06, Vince McMahon wrote: > Hi, > > I have some questions When doing pg_restore of backup of a database to a > NEW server. How large a backup? > > Is there a way to ensure the data integrity is in tact, and user ID and > access works liked how it was in the old server? As to user access, write tests that cover that and run on the new cluster. Data is trickier and if that is possible to a degree of certainty is going to depend on answer to the first question above. > > How to properly handle the materialized views when backing up and restoring? create materialized view prj_mv(p_item_no, year) as select p_item_no, year from projection with data; pg_dump -d production -U postgres -h localhost -t projection -t prj_mv -f prj.sql In prj.sql: CREATE MATERIALIZED VIEW public.prj_mv AS SELECT p_item_no, year FROM public.projection WITH NO DATA; COPY public.projection ( ... [...] REFRESH MATERIALIZED VIEW public.prj_mv; It is done for you. > > Thanks. -- Adrian Klaver adrian.klaver@aklaver.com