Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpFQA-0008Lq-Kl for pgsql-general@arkaria.postgresql.org; Sun, 21 Jul 2019 17:14:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpFQ7-000569-GB for pgsql-general@arkaria.postgresql.org; Sun, 21 Jul 2019 17:14:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpFQ7-000561-3T for pgsql-general@lists.postgresql.org; Sun, 21 Jul 2019 17:14:47 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1hpFQ4-0004sW-7b for pgsql-general@lists.postgresql.org; Sun, 21 Jul 2019 17:14:45 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 269775F79F; Sun, 21 Jul 2019 13:14:42 -0400 (EDT) Date: Sun, 21 Jul 2019 13:14:42 -0400 From: Stephen Frost To: Matthew Pounsett Cc: "Peter J. Holzer" , pgsql-general Subject: Re: Rearchitecting for storage Message-ID: <20190721171441.GF29202@tamriel.snowman.net> References: <20190718173424.GB25488@aart.rice.edu> <20190719152512.cxys4djc4ie6i2ux@hjp.at> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/IXp2N+RDDqJbpyv" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --/IXp2N+RDDqJbpyv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Matthew Pounsett (matt@conundrum.com) wrote: > On Fri, 19 Jul 2019 at 11:25, Peter J. Holzer wrote: > > On 2019-07-19 10:41:31 -0400, Matthew Pounsett wrote: > > > Okay. So I guess the short answer is no, nobody really knows how to > > > judge how much space is required for an upgrade? :) > > > > As I understand it, a pg_upgrade --link uses only negligible extra > > space. It duplicates a bit of householding information, but not your > > data tables or indexes. Your 18 TB table will definitely not be duplica= ted > > during the upgrade if you can use --link. >=20 > The documentation for pg_upgrade --link says that the old copy is no long= er > usable,=20 That's not entirely true- the old copy is only no longer usable *after* you've started the new version of the DB against those data files. If you haven't started the new major version of PG yet, then you can go back to using the old version against those files. > which means it's modifying files that are linked. No, it doesn't. > If it were only > modifying small housekeeping files, then it would be most efficient not to > link those, which would keep both copies of the db usable. The catalog tables *aren't* linked. Both copies of the DB are usable- but only until you start the DB against one of the versions. Once you've started either the old version or the new version, you can't switch. If you started the old version, then you could do another pg_upgrade, of course, but you can't use the new version as there will have been changes made to the catalog tables and control file (which aren't linked) that would have to be accounted for in the new version's catalog by pg_upgrade. > That seems > incompatible with your suggestion that it doesn't need to modify the data > files. Depending on how it goes about doing that, it could mean a > significant short-term increase in storage requirements while the data is > being converted. No, that's not the case- link mode doesn't copy the data files, it just rebuilds the catalog tables and fixes up things in the new database cluster (clog, wal, et al, not the user data tables/indexes). > Going back to our recent 'reindex database' attempt, pgsql does not > necessarily do these things in the most storage-efficient manner; it seems > entirely likely that it would choose to use links to duplicate the data > directory, then create copies of each data file as it converts them over, > then link that back to the original for an atomic replacement. That could > eat up a HUGE amount of storage during the conversion process without the > start and end sizes being very different at all. No, that isn't how pg_upgrade works. Thanks, Stephen --/IXp2N+RDDqJbpyv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJdNJ2BAAoJEO1sijiDR2RV8vsP/iEFOvSqVKjq1M5g7ooY8vLl mbaEB+0K4EDLqDh6dROA47AEYOLo/dwCqN6A5biDfGv9jvADq4xm29z1pZy4MtuW aZuVcrGH8FFPlidvEaZNolfi806bclIurIjNSzG/CSujAzLL0WMC1Ffu6/5cXmwg WtxvV4hiZc76pzcRfC33w9D0+1dbigISs4lMhKlinMs8T2zXUwltgQjG2OsOJTsP Xe41FOBIMYX1bzdlbYMVtRGVYsI8yq6+eA95z3l40iqmr51310UpALhNaSauIDcD K16u3AEiAYM5XtpNwFQw1QUjo04XksQ1GXXTjzyHJhwI755UecUU8ZKYm5f9okRs w+6fdzJ+6Zwc+beuxnt2W6jF6ZZWoUrec+qQqzp/+ZMIfeFPbZ77erNeGKVC0FXX K6lzO2BRNRm19Y5n29ONDW6YoEAffCkt2EGnQk7JSBUdmTAqLWR4gZyqdNmeqgpS MgWkBaQM7NTMA2mLNc5owvUdrC5YCJnN7n2xopbV7uHheZKS2FRj6CU037nUMv0Q 1wtJpkacxlsHH3TWKpwN9Cfy+NCiOEHaFUij3KsqewhYnHI5H81yB2a04GMSoLpF BME4KctaUIa2A739vUHhEH3W2WKU6NMne4alZ+h1rQDE9wLCb45bBQG/7tIOiJXx zrQ4UC19WNt5zHNlaCAI =Nmlh -----END PGP SIGNATURE----- --/IXp2N+RDDqJbpyv--