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 1rYVXW-00GLiy-9J for pgsql-admin@arkaria.postgresql.org; Fri, 09 Feb 2024 18:23:55 +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 1rYVXU-00Akmv-VI for pgsql-admin@arkaria.postgresql.org; Fri, 09 Feb 2024 18:23:52 +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 1rYVXU-00Akmn-88 for pgsql-admin@lists.postgresql.org; Fri, 09 Feb 2024 18:23:52 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rYVXR-005vTp-GP for pgsql-admin@lists.postgresql.org; Fri, 09 Feb 2024 18:23:51 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-410885d28e5so92585e9.3 for ; Fri, 09 Feb 2024 10:23:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1707503027; x=1708107827; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to; bh=Lc/tqDzW++0m39EuvdC7oxl6QwlZgiNpOBocAM5uQ9k=; b=MciBc0uLFjjYwjCW5SPvJp8WDHKxzYhtixkePWDlUUSnrK6fcI6je/3VuA05XCphBu IkeNoiIb2lFkkBzrt5dK8wY2U1YF0fGBuiMP7R6sPMBfMaD9PmkY5EyOv45EqtEz7sFn 1HjUQkyhwnshKSqKEVAfGpAgRaefoVpTMD94TWTzGozvapHsBEUmzcbcpmKS9fHIKrHE pv1HVem3j9oiemetknHuwJNMYGf8jxAasDp8WpLtYu0N3TnR2YIFD86hkdMh36bcvggo FyspJfbsd30UGr43DmVqlKwKbsisY3ch/Hmb8ANlc1PiaI8kjyr32VbWasG9InGmQnBu /gDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707503027; x=1708107827; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Lc/tqDzW++0m39EuvdC7oxl6QwlZgiNpOBocAM5uQ9k=; b=EJTEgwJirO7hOuWxpHtOa556QxxoRpzq+A6oDgXHA+DPfGFGWrqF7Wk6rlWUqy991x WGRyGWu0CFcVjB3FA9WK+LYd5UcHg4x5O68N+QXq5XCuPQDlOlHCZHeyyjylk9fLyGKB Cp0HtsljsnqjrI3aZUYcwvV0o5KhEAFe5/nTCi9RpyvVQMICu8kTVOgwJ1RuAR5AU+b9 BB3yc2oFoFR9EbLNY8BHNQpQWkhq43TYXKMEFsYObRzjFGsSEXt7aYgtZi+9CwascOav 4NfQdePXRuhbhGTsyIRv6/Pytn0V2eEjec37r1jO3muhfpe4FCHkUmLgJnp+FCevQq5r xc7Q== X-Forwarded-Encrypted: i=1; AJvYcCVanqw21HVEia/V+jAGs0Zz0xekDwHZPlIU80iWohesYS8mRNKGi5/4GHDN3PpnCGVRvUAUWHSDt6c/HSxqQad6RUGRnxTmCXXLm1RNVchx8Q== X-Gm-Message-State: AOJu0YzFRFqZ+9hkVbLLFwOALZJDJnqh1bUl2Fsn6sj5GQlGnkcqLl5R FJyEO19QAweIq8h/GzSmlQH77B22pAUhGa0W3HWkfZ/JCoh+nODZ9oaCtx2j5q4= X-Google-Smtp-Source: AGHT+IF68mar6WETIb0ZjSf69bKMn5mRzOnBhPAYFA0jHhD0ilkdDteHX10dVbpxLc9QNdlIbhSaKw== X-Received: by 2002:a05:600c:1c1d:b0:410:2496:ccdd with SMTP id j29-20020a05600c1c1d00b004102496ccddmr92339wms.27.1707503027285; Fri, 09 Feb 2024 10:23:47 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWXXPesA6UUHq2X8KHgC97pTeliOP1MZ9gzRBr4pe/TZixLqysr4t32qhLwxXpZ7TF1YtPir0hmF7Mq9eK5eZ+FYB+810y1DVc35iqodx50ag== Received: from localhost.localdomain ([213.235.133.41]) by smtp.gmail.com with ESMTPSA id f17-20020adfdb51000000b0033b599c61besm2404328wrj.34.2024.02.09.10.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 10:23:47 -0800 (PST) Message-ID: <63f7bffb3c3576b606aae56c736c781640f990ec.camel@cybertec.at> Subject: Re: upgrade questions From: Laurenz Albe To: David Barron , "pgsql-admin@lists.postgresql.org" Date: Fri, 09 Feb 2024 19:23:08 +0100 In-Reply-To: References: Autocrypt: addr=laurenz.albe@cybertec.at; prefer-encrypt=mutual; keydata=mQINBGGDwAQBEADgbWy5cKXQld3N2mF+DFyiNFbi2oBl2T+XgxpPF8wTRw2D/u4bBKXP0SYSE/lA86jIVNWWU0gf1KODIkVvgJm2w4vH2VBV1b7ddVViGl1Iu+9zaRnv9wulhnH42KefepXnoean6UT1EzLM0opF/Ik0j+40TxdRtobkBprkQUyHDXWlHc2ffPs3SipyFEP9AVLf7ejRC46CXWDnsqjOBSMEW8Z4HiK/8RrPZBsKLts8dJxKF4pygOdJb0CWk8k/X1jbcfdxo+zOLjOMvJcSJ2pFdJmQHU+JufB3rePziqQ2S9Ur6sccr9XnTC1GVBWN4Lf5VHq+vf+bFJjVwg+2hrySZnAVfcOrxoqFLErr7ug1zN2nM1kcpgA4VWn4gxlJtYNYYq+9WxX5dtvnNANlG3ZCrRKQzl8lxtzoF6Z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uEm54lNhJz//ar86Or5BErzNpM6TL7lk44QS06hwsMrEdKIy8J/SYJPjfzR8tIUnKscclVpOgjKaBqC+0iFiVaRqAgfOlIEiezX6kMh5Q2FIUfqs46qWhhXjRrdKOEoStYAaikdLu5ZXr7vfb0ZaDh+ZwTQtbSMFolyOkecwI81MCdbMfT/1TqIGTOdAj5as9fAakk0jb2pXgUYQ8X1DVTR8ahSDVEaw9VTmWiSvTxvguVJ1Mb7gG4Gmh6aviDTJhfXtH4rPUNXhDLqrTH8JkJjyKROOMakIF68Hjse5vUfUxreBEOtb5r1Coa2Fe7ncJayaSE7ryrDbFqpZ 36UMAx4ulWMyqJajLNGY0DdG8qIsR5nxRhrnK/mrCidZ8F9/D3bWAl4rjtHlsztN59 +AnW5l0HsQcY9ntFL/zEBOaonjdJf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 (3.50.3-1.fc39) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2024-02-09 at 17:00 +0000, David Barron wrote: > I=E2=80=99m going to be doing an upgrade from version 11 to version 15 so= metime in the near future. > I=E2=80=99m a bit nervous about it and I=E2=80=99m hoping I can get some = questions answered before I take the big step. You will do it on a test system first, right? Because you have to test the application. Also, make sure that you have a good backup. > First, I=E2=80=99m working on RedHat Linux servers. > Second the existing install is not using the default data directory (/var= /lib/pgsql/11/data). > Because of decisions that were made before I got my hands on the servers = the data directory > is /pgdata-system/11/data.=C2=A0 That=E2=80=99s where the pg_hba.conf and= postgresql.conf are located. > Third, 3 tablespaces were created, /pgdata-staging, /pgdata-prod and /pgd= ata-temp. > I=E2=80=99ve got the last one setup as the location for temporary files. No problem at all, as far as the upgrade is concerned. > From my understanding of the docs I have to do the following: > =C2=A0 > Download and install the postgresql-15 package, of course. > Stop the running server (systemctl stop postgresql-11) > =C2=A0 > As the postgres user run these two commands > =C2=A0 > /usr/pgsql-15/bin/initdb -D /pgdata-system/15/data You have to create the new cluster with the same encoding and locale as the old one (check \l on the old cluster). Run "pg_upgrade ... --check" first (can be done while the old server is running), that will show you if there are any potential problems. > /usr/pgsql-15/bin/pg_upgrade -b /usr/pgsql-11/bin -B /usr/pgsql-15/bin -d= /pgdata-system/11/data -D /pgdata-system/15/data You also have to take care of the configuration files. You can just copy "pg_hba.conf" and "pg_ident.conf", but you shouldn't do t= hat with "postgresql.conf" and "postgresql.auto.conf". Rather, edit them side by side and manually copy modified ssettings over, checking if the parameter still exists in the new version. > Then start postgres 15 (systemctl enable postgresql-15 and systemctl star= t postgresql-15) Table statistics are not upgraded. After starting the new server, connect to all database you can and run ANALYZE there. That may take a while and will create table statistics (essential for query performance). > So, here are my questions. > Are those commands all I will need to run? I made remarks inline. > Will the tablespaces be moved over to the new data directory?=C2=A0 I ask= because > I don=E2=80=99t see any references to tablespaces in the doc for pg_upgra= de. All tablespace directories will grow a new subdirectory for the new version= , and the datafiles will get copied. There is nothing to do, except remove t= he files for the old cluster once you are satisfied that you won't fall back t= o the old server. > Is there a =C2=A0calculation I can do to determine the amount of disk spa= ce the upgrade > is going to take?=C2=A0 I know the total amount will depend on the size o= f the database, > but is it going to require double the space currently being used or some = smaller > amount.=C2=A0 Disk space is somewhat limited, so that=E2=80=99s a concern= . Since the data files are copied as they are, the new cluster will occupy pr= etty much the same space as the old one. If you want to avoid that, you can create the new cluster on the same file = system as the old one and use the --link option of pg_upgrade to create hard links= instead of copying the files. That will use hardly any additional disk space and b= e fast as lightning. The drawback is that you *must* delete the old cluster right= away, and you cannot use it to fall back to in case something goes wrong. Yours, Laurenz Albe